@@ -54,6 +54,10 @@ class C(marshmallow.Model):
54
54
a = marshmallow .NestedModel (A , many = True )
55
55
56
56
57
+ class MultiInheritance (A , B , C ):
58
+ pass
59
+
60
+
57
61
def serialize_context_field (obj , context = None ):
58
62
return obj .test_field == context ['value' ]
59
63
@@ -80,27 +84,43 @@ def test_schema_name(self):
80
84
81
85
def test_schema_class (self ):
82
86
assert issubclass (A .__schema_class__ , marshmallow .Schema )
87
+ assert issubclass (
88
+ MultiInheritance .__schema_class__ , marshmallow .Schema )
83
89
84
90
def test_model_class (self ):
85
91
assert issubclass (A .__schema_class__ .__model_class__ ,
86
92
marshmallow .Model )
93
+ assert issubclass (
94
+ MultiInheritance .__schema_class__ .__model_class__ ,
95
+ marshmallow .Model )
87
96
88
97
def test_tag_processor (self ):
89
98
assert hasattr (A .__schema_class__ , 'set_tag_field' )
99
+ assert hasattr (MultiInheritance .__schema_class__ , 'set_tag_field' )
90
100
91
101
def test_meta (self ):
92
102
assert hasattr (A .__schema_class__ , 'Meta' )
93
103
self .assertEqual (id (A .Meta ), id (A .__schema_class__ .Meta ))
94
104
assert not hasattr (B , 'Meta' )
95
105
assert hasattr (B .__schema_class__ , 'Meta' )
106
+ self .assertEqual (
107
+ id (MultiInheritance .Meta ),
108
+ id (MultiInheritance .__schema_class__ .Meta ))
109
+ assert hasattr (MultiInheritance .__schema_class__ , 'Meta' )
96
110
97
111
def test_on_bind_filed (self ):
98
112
self .assertEqual (
99
113
id (A .on_bind_field ), id (A .__schema_class__ .on_bind_field ))
114
+ self .assertEqual (
115
+ id (MultiInheritance .on_bind_field ),
116
+ id (MultiInheritance .__schema_class__ .on_bind_field ))
100
117
101
118
def test_handle_error (self ):
102
119
self .assertEqual (
103
120
id (A .handle_error ), id (A .__schema_class__ .handle_error ))
121
+ self .assertEqual (
122
+ id (MultiInheritance .handle_error ),
123
+ id (MultiInheritance .__schema_class__ .handle_error ))
104
124
105
125
106
126
class TestModel (unittest .TestCase ):
0 commit comments