Skip to content

Commit

Permalink
parametrize test_runs
Browse files Browse the repository at this point in the history
  • Loading branch information
danlessa committed Dec 21, 2023
1 parent d7e38cb commit e11a8b4
Showing 1 changed file with 12 additions and 29 deletions.
41 changes: 12 additions & 29 deletions testing/test_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,42 +158,25 @@ def sweeped(params: Parameters, substep: Substep, history: StateHistory, state:
)
return exp


def test_mc_sweep_experiment():
experiment_assertions(create_experiment(
N_RUNS=2, N_TIMESTEPS=2, params=SWEEP_PARAMS), ExecutionMode.local_mode)
experiment_assertions(create_experiment(
N_RUNS=2, N_TIMESTEPS=2, params=SWEEP_PARAMS), ExecutionMode.single_mode)
@pytest.mark.parametrize("mode", ["local_proc", "single_proc", "multi_proc"])
def test_mc_sweep_experiment(mode):
experiment_assertions(create_experiment(
N_RUNS=2, N_TIMESTEPS=2, params=SWEEP_PARAMS), ExecutionMode.multi_mode)
N_RUNS=2, N_TIMESTEPS=2, params=SWEEP_PARAMS), mode)


def test_unique_sweep_experiment():
experiment_assertions(create_experiment(
N_RUNS=1, N_TIMESTEPS=2, params=SWEEP_PARAMS), ExecutionMode.local_mode)
experiment_assertions(create_experiment(
N_RUNS=1, N_TIMESTEPS=2, params=SWEEP_PARAMS), ExecutionMode.single_mode)
@pytest.mark.parametrize("mode", ["local_proc", "single_proc", "multi_proc"])
def test_unique_sweep_experiment(mode):
experiment_assertions(create_experiment(
N_RUNS=1, N_TIMESTEPS=2, params=SWEEP_PARAMS), ExecutionMode.multi_mode)
N_RUNS=1, N_TIMESTEPS=2, params=SWEEP_PARAMS), mode)


def test_mc_single_experiment():
experiment_assertions(create_experiment(
N_RUNS=2, N_TIMESTEPS=2, params=SINGLE_PARAMS), ExecutionMode.local_mode)
experiment_assertions(create_experiment(
N_RUNS=2, N_TIMESTEPS=2, params=SINGLE_PARAMS), ExecutionMode.single_mode)
@pytest.mark.parametrize("mode", ["local_proc", "single_proc", "multi_proc"])
def test_mc_single_experiment(mode):
experiment_assertions(create_experiment(
N_RUNS=2, N_TIMESTEPS=2, params=SINGLE_PARAMS), ExecutionMode.multi_mode)
N_RUNS=2, N_TIMESTEPS=2, params=SINGLE_PARAMS), mode)


def test_unique_single_experiment():
experiment_assertions(create_experiment(
N_RUNS=1, N_TIMESTEPS=2, params=SINGLE_PARAMS), ExecutionMode.local_mode)
@pytest.mark.parametrize("mode", ["local_proc", "single_proc", "multi_proc"])
def test_unique_single_experiment(mode):
experiment_assertions(create_experiment(
N_RUNS=1, N_TIMESTEPS=2, params=SINGLE_PARAMS), ExecutionMode.single_mode)
with pytest.raises(ValueError) as e_info:
experiment_assertions(create_experiment(
N_RUNS=1, N_TIMESTEPS=2, params=SINGLE_PARAMS), ExecutionMode.multi_mode)
N_RUNS=1, N_TIMESTEPS=2, params=SINGLE_PARAMS), mode)


def experiment_assertions(exp, mode=None):
Expand Down

0 comments on commit e11a8b4

Please sign in to comment.