Skip to content

Commit

Permalink
feat: added test for invalid material
Browse files Browse the repository at this point in the history
  • Loading branch information
smolvik1 committed Nov 13, 2023
1 parent a873362 commit fb388b9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test_erosion.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,19 @@ 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'))]
@pytest.mark.parametrize('material, E', material_validation)
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',
Expand All @@ -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
Expand Down

0 comments on commit fb388b9

Please sign in to comment.