Esempio n. 1
0
    def test_extend_is_deprecated(self):
        parent = Model('Parent', {
            'name': fields.String,
            'age': fields.Integer,
            'birthdate': fields.DateTime,
        })

        with pytest.warns(DeprecationWarning):
            child = parent.extend('Child', {
                'extra': fields.String,
            })

        assert child.__schema__ == {
            'properties': {
                'name': {
                    'type': 'string'
                },
                'age': {
                    'type': 'integer'
                },
                'birthdate': {
                    'type': 'string',
                    'format': 'date-time'
                },
                'extra': {
                    'type': 'string'
                }
            },
            'type': 'object'
        }
Esempio n. 2
0
    def test_extend_is_deprecated(self):
        parent = Model(
            "Parent",
            {
                "name": fields.String,
                "age": fields.Integer,
                "birthdate": fields.DateTime,
            },
        )

        with pytest.warns(DeprecationWarning):
            child = parent.extend("Child", {"extra": fields.String,})

        assert child.__schema__ == {
            "properties": {
                "name": {"type": "string"},
                "age": {"type": "integer"},
                "birthdate": {"type": "string", "format": "date-time"},
                "extra": {"type": "string"},
            },
            "type": "object",
        }