Skip to content

Commit

Permalink
Refactor and parametrize test_montecarlo_line_scatter.
Browse files Browse the repository at this point in the history
- Scientifically sound test cases are required to add in.
  • Loading branch information
karandesai-96 committed Apr 5, 2016
1 parent c78a79e commit 183db92
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions tardis/montecarlo/tests/test_cmontecarlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,29 @@ def test_increment_j_blue_estimator(packet_params, j_blue_idx, expected, packet,
np.testing.assert_almost_equal(model.line_lists_j_blues[j_blue_idx], expected)


def test_montecarlo_line_scatter():
assert tests.test_montecarlo_line_scatter()
@pytest.mark.parametrize(
['packet_params', 'expected_params'],
# TODO: Add scientifically sound test cases.
[({'virtual_packet': 1, 'tau_event': 2.9e13, 'last_line': 0},
{'tau_event': 2.9e13, 'next_line_id': 2}),
({'virtual_packet': 0, 'tau_event': 2.9e13, 'last_line': 0},
{'tau_event': 2.9e13, 'next_line_id': 2}),
({'virtual_packet': 0, 'tau_event': 2.9e13, 'last_line': 0},
{'tau_event': 2.9e13, 'next_line_id': 2}),
]
)
def test_montecarlo_line_scatter(packet_params, expected_params, packet, model, mt_state):
packet.virtual_packet = packet_params['virtual_packet']
packet.tau_event = packet_params['tau_event']
packet.last_line = packet_params['last_line']

cmontecarlo_methods.montecarlo_line_scatter(byref(packet), byref(model),
c_double(1.e13), byref(mt_state))

np.testing.assert_almost_equal(packet.tau_event, expected_params['tau_event'])
np.testing.assert_almost_equal(packet.next_line_id, expected_params['next_line_id'])


def test_move_packet_across_shell_boundary():
Expand Down

0 comments on commit 183db92

Please sign in to comment.