diff --git a/tardis/montecarlo/tests/test_cmontecarlo.py b/tardis/montecarlo/tests/test_cmontecarlo.py index a976c0cd62c..9ad2b4cd5fb 100644 --- a/tardis/montecarlo/tests/test_cmontecarlo.py +++ b/tardis/montecarlo/tests/test_cmontecarlo.py @@ -357,6 +357,27 @@ def test_move_packet(packet_params, expected_params, packet, model): assert_almost_equal(model.nubars[packet.current_shell_id], expected_params['nubar']) +# TODO: add proper test cases. +@pytest.mark.parametrize( + ['packet_params', 'expected_params'], + [({'nu': 0.4, 'mu': 0.3, 'energy': 0.9}, + {'nu': 0.4, 'mu': 0.3, 'energy': 0.9})] +) +@pytest.mark.skipif(True, reason="generates unexpected segfault") +def test_montecarlo_thomson_scatter(packet_params, expected_params, packet, + model, mt_state): + packet.nu = packet_params['nu'] + packet.mu = packet_params['mu'] + packet.energy = packet_params['energy'] + + cmontecarlo_methods.montecarlo_thomson_scatter(byref(packet), byref(model), + c_double(1.e13), byref(mt_state)) + + assert_almost_equal(packet.nu, expected_params['nu']) + assert_almost_equal(packet.mu, expected_params['mu']) + assert_almost_equal(packet.energy, expected_params['energy']) + + @pytest.mark.parametrize( ['packet_params', 'expected_params'], [({'virtual_packet': 0, 'current_shell_id': 0, 'next_shell_id': 1}, @@ -391,10 +412,6 @@ def test_montecarlo_one_packet_loop(): assert cmontecarlo_tests.test_montecarlo_one_packet_loop() == 0 -def test_montecarlo_thomson_scatter(): - assert cmontecarlo_tests.test_montecarlo_thomson_scatter() - - @pytest.mark.xfail def test_montecarlo_bound_free_scatter(): assert cmontecarlo_tests.test_montecarlo_bound_free_scatter() == 1