Skip to content

Commit

Permalink
add names to params (see fixme in parametrize)
Browse files Browse the repository at this point in the history
  • Loading branch information
moreib committed Oct 27, 2023
1 parent 3f54a87 commit b5a8c9a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions hannah/nas/test/test_parametrize.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_set_current():

def test_set_params():
rng = default_rng(seed=321)
parametrized_test = ParametrizedTest(a=IntScalarParameter(min=10, max=20, rng=rng))
parametrized_test = ParametrizedTest(a=IntScalarParameter(min=10, max=20, rng=rng, name='a'))
parametrized_test.set_params(a=16)

assert parametrized_test.a.current_value == 16
Expand All @@ -95,9 +95,9 @@ def test_set_params():
def test_set_params_nested():
rng = default_rng(seed=321)
parametrized_test = NestedParametrizedTest(
t=ParametrizedTest(a=IntScalarParameter(min=10, max=20, rng=rng))
t=ParametrizedTest(a=IntScalarParameter(min=10, max=20, rng=rng, name='a'))
)
other_test_object = ParametrizedTest(a=IntScalarParameter(min=0, max=3, rng=rng))
other_test_object = ParametrizedTest(a=IntScalarParameter(min=0, max=3, rng=rng, name='a'))

parametrized_test.set_params(t=other_test_object)
assert parametrized_test.t == other_test_object
Expand All @@ -122,7 +122,7 @@ def test_set_params_nested():

def test_instantiate():
rng = default_rng(seed=321)
parametrized_test = ParametrizedTest(a=IntScalarParameter(min=10, max=20, rng=rng))
parametrized_test = ParametrizedTest(a=IntScalarParameter(min=10, max=20, rng=rng, name='a'))
parametrized_test.sample()
instance = parametrized_test.instantiate()
assert instance.a == 14
Expand All @@ -136,9 +136,9 @@ def test_instantiate():

rng = default_rng(seed=321)
parametrized_test = NestedParametrizedTest(
t=ParametrizedTest(a=IntScalarParameter(min=10, max=20, rng=rng))
t=ParametrizedTest(a=IntScalarParameter(min=10, max=20, rng=rng, name='a'))
)
other_test_object = ParametrizedTest(a=IntScalarParameter(min=0, max=3, rng=rng))
other_test_object = ParametrizedTest(a=IntScalarParameter(min=0, max=3, rng=rng, name='a'))

parametrized_test.set_params(t=other_test_object)
parametrized_test.set_params(t={"a": 2})
Expand Down

0 comments on commit b5a8c9a

Please sign in to comment.