Skip to content

Commit

Permalink
added test for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
RemDelaporteMathurin committed Nov 26, 2024
1 parent 92a79e7 commit 9afcbe7
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/test_fuel_types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import pytest

from openmc_plasma_source import get_neutron_energy_distribution
from openmc_plasma_source import (
get_neutron_energy_distribution,
get_reactions_from_fuel,
)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -45,3 +48,22 @@ def test_fuel_with_incorrect_isotopese(temperature, fuel):
# Should reject anything which is not 'D' or 'T'.
with pytest.raises(ValueError):
get_neutron_energy_distribution(temperature, fuel)


@pytest.mark.parametrize(
"fuel, expected_output",
[
({"D": 1.0}, ["DD"]),
({"T": 1.0}, ["TT"]),
({"T": 0.5, "D": 0.5}, ["DT", "DD", "TT"]),
({"D": 0.2, "T": 0.8}, ["DT", "DD", "TT"]),
({"coucou": 0.2}, None),
],
)
def test_get_reactions_from_fuel(fuel, expected_output):
"""Test the get_reactions_from_fuel function"""
if expected_output is None:
with pytest.raises(ValueError, match=f"{fuel}"):
get_reactions_from_fuel(fuel)
else:
assert get_reactions_from_fuel(fuel) == expected_output

0 comments on commit 9afcbe7

Please sign in to comment.