class TestOneSchema(v1_TypeMetaSchema): __model__ = TestOne __typemeta__ = TypeMeta('One', 'v1') @post_load def load_obj(self, data, **kw): return self.__model__()
def test_register(self): registry = TypeMetaRegistry() typemeta_1 = TypeMeta('One', 'v1') typemeta_2 = TypeMeta('Two', 'v1') typemeta_2_1 = TypeMeta('Two', 'v1') class TestOne: __model__ = object() __typemeta__ = typemeta_1 class TestTwo: __model__ = object() __typemeta__ = typemeta_2 registry.register(TestOne) registry.register(TestTwo) assert registry[typemeta_1] is TestOne assert registry[typemeta_2] is TestTwo assert registry[typemeta_2_1] is TestTwo
class TestOneSchema(v1_TypeMetaSchema): __typemeta__ = TypeMeta('One', 'v1')
class Schema(v1_TypeMetaSchema): __typemeta__ = TypeMeta('Test', 'test/v1')