diff --git a/tests/test_fuel_types.py b/tests/test_fuel_types.py index b0a2c8a..f5ca4bc 100644 --- a/tests/test_fuel_types.py +++ b/tests/test_fuel_types.py @@ -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( @@ -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