From fb388b9e0d0365a3af29305c846d35fba3751085 Mon Sep 17 00:00:00 2001 From: smolvik1 Date: Mon, 13 Nov 2023 08:45:50 +0100 Subject: [PATCH] feat: added test for invalid material --- tests/test_erosion.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_erosion.py b/tests/test_erosion.py index fa94d4a..498bdad 100644 --- a/tests/test_erosion.py +++ b/tests/test_erosion.py @@ -325,7 +325,7 @@ def test_F(a_rad, angle_dependency, E): F(a_rad, angle_dependency) -# Material properties function # +# Material properties function material_validation = [('carbon_steel', (7800, 2e-9, 2.6, 'ductile')), ('grp_epoxy', (1800, 3e-10, 3.6, 'ductile')), ('psz_ceramic_zirconia', (5700, 4.1e-9, 2.5, 'brittle'))] @@ -333,6 +333,11 @@ def test_F(a_rad, angle_dependency, E): def test_get_material_properties(material, E): assert get_material_properties(material) == E + +def test_get_material_properties_invalid_material(): + with pytest.raises(exc.FunctionInputFail): + get_material_properties(material='invalid material') + # Test material list and error raising def test_get_materials(): material_list = ['carbon_steel', 'duplex', 'ss316', 'inconel', 'grp_epoxy', 'grp_vinyl_ester', 'hdpe', 'aluminium', @@ -341,6 +346,7 @@ def test_get_materials(): 'TiB2_titanium_diboride', 'B4C_boron_carbide', 'SiSiC_ceramic_carbide'] assert get_materials() == material_list + def test_return_nan(): v_m = 29.3 rho_m = 30