def test_shallow_copy(): pd1 = ParamDict(a=3, b=4) pd2 = pd1.copy_recursive() pd1.a = 1 pd2.a = 2 pd2.b = 2 pd1.b = 1 assert pd1.a == 1 assert pd1.b == 1 assert pd2.a == 2 assert pd2.b == 2
def test_add_params_after_init_raises_with_attribute_notation(): pd = ParamDict() with pytest.raises(RuntimeError): pd.a = 1