def test_map_recurse(): assert parse({ "type": "map", "value_dtype": { "type": "string" } }) == ParamSchema.Map(value_schema=ParamSchema.String())
def test_validate_not_dict(self): with pytest.raises(ValueError, match="not a dict"): S.Map(value_schema=S.String()).validate([])
def test_validate_ok(self): schema = S.Map(value_schema=S.String()) value = {"a": "b", "c": "d"} schema.validate(value)
def test_validate_bad_inner_schema(self): with pytest.raises(ValueError, match="not a string"): S.Map(value_schema=S.String()).validate({"a": "1", "c": 2})
def test_default(self): assert S.Map(S.String()).default == {}