def test___new___annotations_resolved(self): # Check that annotations that require resolving can be used. class NestedExample(Model): a = fields.Int() class Example(Model): a: int nested: NestedExample # The field attributes should not be present on the final class. assert not hasattr(Example, 'a') assert not hasattr(Example, 'nested') # But they should be in the `__fields__` attribute assert Example.__fields__.a == fields.Int() assert Example.__fields__.nested == fields.Nested(NestedExample)
class Package(Model): name = fields.Str(rename='packageName') version = fields.Nested(Version)
class Example(Model): nested = fields.Nested(NestedExample)
class Example(Model): class Meta: tag = Adjacent(tag='kind', content='data') nested = fields.Nested(NestedExample)
class Example(Model): class Meta: tag = Internal(tag='kind') nested = fields.Nested(NestedExample)
class Example(Model): class Meta: tag = External() nested = fields.Nested(NestedExample)