From b5a8c9a651dd6a6e752f1c601aaab4b1fbf45b18 Mon Sep 17 00:00:00 2001 From: Moritz Reiber Date: Fri, 27 Oct 2023 13:30:54 +0200 Subject: [PATCH] add names to params (see fixme in parametrize) --- hannah/nas/test/test_parametrize.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hannah/nas/test/test_parametrize.py b/hannah/nas/test/test_parametrize.py index fab89636..7830351b 100644 --- a/hannah/nas/test/test_parametrize.py +++ b/hannah/nas/test/test_parametrize.py @@ -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 @@ -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 @@ -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 @@ -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})