Skip to content

Commit

Permalink
increased coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
RemDelaporteMathurin committed Oct 19, 2023
1 parent fd3b0ef commit ec2d15e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/test_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,42 @@ def test_assign_functions_to_species():
assert isinstance(spe.test_function, ufl.Argument)


def test_species_repr_and_str():
"""Test that the __repr__ and __str__ methods of the Species class returns the
expected string.
"""
# create a species
species = F.Species("A")

# check that the __repr__ method returns the expected string
expected_repr = "Species(A)"
assert repr(species) == expected_repr

# check that the __str__ method returns the expected string
expected_str = "A"
assert str(species) == expected_str


def test_implicit_species_repr_and_str():
"""Test that the __repr__ and __str__ methods of the ImplicitSpecies class
returns the expected string.
"""
# create two species
species1 = F.Species("A")
species2 = F.Species("B")

# create an implicit species that depends on the two species
implicit_species = F.ImplicitSpecies(3.0, [species1, species2], name="C")

# check that the __repr__ method returns the expected string
expected_repr = f"ImplicitSpecies(C, 3.0, {[species1, species2]})"
assert repr(implicit_species) == expected_repr

# check that the __str__ method returns the expected string
expected_str = "C"
assert str(implicit_species) == expected_str


def test_implicit_species_concentration():
"""Test that the concentration of an implicit species is computed
correctly.
Expand Down

0 comments on commit ec2d15e

Please sign in to comment.