Skip to content

Commit

Permalink
test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
danlessa committed Jan 18, 2024
1 parent 2d08c90 commit 9f6134d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions testing/test_param_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@
P_all_swp = {'pA': [1, 2, 3], 'pB': [1, 2, 3], 'pC': [1, 2, 3]}
Ps = [P_no_lst, P_single_lst, P_single_swp, P_all_swp]

BASE_CONFIG_SIGNATURES_TO_TEST = [(3, 3, 3, 3, 3), (1, 3, 3, 3, 3),
CONFIG_SIGNATURES_TO_TEST = [(3, 3, 3, 3, 3), (1, 3, 3, 3, 3),
(3, 1, 3, 3, 3), (1, 1, 3, 3, 3),
(3, 3, 1, 3, 3), (1, 3, 1, 3, 3), (1, 1, 1, 3, 3)]

CONFIG_SIGNATURES_TO_TEST = []
for p in Ps:
for config in BASE_CONFIG_SIGNATURES_TO_TEST:
CONFIG_SIGNATURES_TO_TEST.append(config + tuple([p]))


def run_experiment(exp: Experiment, mode: str):
exec_context = ExecutionContext(mode)
Expand Down Expand Up @@ -65,14 +60,14 @@ def expected_rows(N_simulations, N_sweeps, N_runs, N_timesteps, N_substeps,P) ->
return N_simulations * N_sweeps * N_runs * (N_timesteps * N_substeps + 1)


@pytest.mark.parametrize("N_sim,N_sw,N_r,N_t,N_s", BASE_CONFIG_SIGNATURES_TO_TEST)
@pytest.mark.parametrize("N_sim,N_sw,N_r,N_t,N_s", CONFIG_SIGNATURES_TO_TEST)
@pytest.mark.parametrize("P", Ps)
def test_row_count_single(N_sim, N_sw, N_r, N_t, N_s, P):
args = (N_sim, N_sw, N_r, N_t, N_s, P)
assert len(run_experiment(create_experiments(*args), 'single_proc')) == expected_rows(*args)


@pytest.mark.parametrize("N_sim,N_sw,N_r,N_t,N_s", BASE_CONFIG_SIGNATURES_TO_TEST)
@pytest.mark.parametrize("N_sim,N_sw,N_r,N_t,N_s", CONFIG_SIGNATURES_TO_TEST)
@pytest.mark.parametrize("P", Ps)
def test_row_count_multi(N_sim, N_sw, N_r, N_t, N_s, P):
args = (N_sim, N_sw, N_r, N_t, N_s, P)
Expand All @@ -84,7 +79,7 @@ def test_row_count_multi(N_sim, N_sw, N_r, N_t, N_s, P):
assert len(run_experiment(create_experiments(*args), 'multi_proc')) == expected_rows(*args)


@pytest.mark.parametrize("N_sim,N_sw,N_r,N_t,N_s", BASE_CONFIG_SIGNATURES_TO_TEST)
@pytest.mark.parametrize("N_sim,N_sw,N_r,N_t,N_s", CONFIG_SIGNATURES_TO_TEST)
@pytest.mark.parametrize("P", Ps)
def test_row_count_local(N_sim, N_sw, N_r, N_t, N_s, P):
args = (N_sim, N_sw, N_r, N_t, N_s, P)
Expand Down

0 comments on commit 9f6134d

Please sign in to comment.