Skip to content

Commit

Permalink
additional test for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdark committed Oct 30, 2023
1 parent bead7e3 commit 22de6a6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,18 @@ def test_temperature_value_updates_with_HTransportProblem(value):
if isinstance(expected_value, Conditional):
expected_value = float(expected_value)
assert np.isclose(computed_value, expected_value)


def test_TypeError_raised_when_temperature_not_defined():
"""Test that a type error when a model is initialised without
defining a temperature"""
my_model = F.HydrogenTransportProblem(
mesh=test_mesh,
subdomains=[F.VolumeSubdomain1D(1, borders=[0, 4], material=dummy_mat)],
species=[F.Species("H")],
settings=F.Settings(atol=1, rtol=0.1, final_time=3),
)
my_model.settings.stepsize = F.Stepsize(initial_value=1)

with pytest.raises(TypeError, match="Temperature needs to be defined"):
my_model.initialise()

0 comments on commit 22de6a6

Please sign in to comment.