diff --git a/python/ngen_cal/tests/conftest.py b/python/ngen_cal/tests/conftest.py index 1cebd170..e3af5da5 100644 --- a/python/ngen_cal/tests/conftest.py +++ b/python/ngen_cal/tests/conftest.py @@ -226,9 +226,10 @@ def explicit_catchments(nexus, fabric, workdir) -> Generator[ List[ CalibrationC @pytest.fixture def multi_model_shared_params() -> Mapping[str, list[Parameter]]: p1 = Parameter(name='a', min=0, max=1, init=0) - p2 = Parameter(name='a', min=0, max=1, init=0) + p2 = Parameter(name='d', min=2, max=3, init=0) p3 = Parameter(name='c', min=0, max=1, init=0) - params = {'A':[p1], 'B':[p2], 'C':[p3]} + p4 = Parameter(name='a', min=0, max=1, init=0) + params = {'A':[p1], 'B':[p2, p4], 'C':[p3, p4]} return params diff --git a/python/ngen_cal/tests/test_params.py b/python/ngen_cal/tests/test_params.py index a21767e3..bb483c9d 100644 --- a/python/ngen_cal/tests/test_params.py +++ b/python/ngen_cal/tests/test_params.py @@ -17,13 +17,16 @@ def test_multi_params(multi_model_shared_params: Mapping[str, list[Parameter]]): # create new iteration from old params['1'] = params['0'] #update the parameters by index - params.loc['a', '1'] = 0.5 - pa = params[ params['model'] == 'A' ] - pb = params[ params['model'] == 'B' ] - pc = params[ params['model'] == 'C' ] - assert pa.drop('model', axis=1).equals( pb.drop('model', axis=1) ) + idx1 = 'a' + idx2 = 'c' + params.loc[idx1, '1'] = 0.5 + pa = params[ params['model'] == 'A' ].loc[idx1] + pb = params[ params['model'] == 'B' ].loc[idx1] + pc = params[ params['model'] == 'C' ].loc[idx2] + + assert pa.drop('model').equals( pb.drop('model') ) # ensure unique params/alias are not modifed by selection - assert pa.loc['a', '1'] != pc.loc['c', '1'] + assert pa.loc['1'] != pc.loc['1'] def test_multi_params2(multi_model_shared_params2: Mapping[str, list[Parameter]]): # This is essentially the path the params go through from