def test_jsoninit_class_from_env_var(): os.environ['PARAM_JSON_INIT'] = '{"a": 1}' json_init = JSONInit() class Test(param.Parameterized): a = param.Integer() json_init(Test) assert Test.a == 1 del os.environ['PARAM_JSON_INIT']
def test_jsoninit_instance_from_env_var(): os.environ['PARAM_JSON_INIT'] = '{"a": 2}' json_init = JSONInit() class Test(param.Parameterized): a = param.Integer() test = Test() json_init(test) assert test.a == 2 del os.environ['PARAM_JSON_INIT']