コード例 #1
0
ファイル: test_fields.py プロジェクト: tomduval/flask-restx
    def test_to_dict_obj(self):
        class Foo(object):
            def __init__(self):
                self.foo = 42

        expected = {"foo": 42}
        assert fields.to_marshallable_type(Foo()) == expected
コード例 #2
0
ファイル: test_fields.py プロジェクト: tomduval/flask-restx
    def test_to_dict_custom_marshal(self):
        class Foo(object):
            def __marshallable__(self):
                return {"foo": 42}

        expected = {"foo": 42}
        assert fields.to_marshallable_type(Foo()) == expected
コード例 #3
0
ファイル: test_fields.py プロジェクト: tomduval/flask-restx
 def test_to_dict(self):
     expected = data = {"foo": 42}
     assert fields.to_marshallable_type(data) == expected