We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6d6e2f6 commit a63fde1Copy full SHA for a63fde1
tests/test_schema_type.py
@@ -0,0 +1,30 @@
1
+import unittest
2
+
3
+import marshmallow
4
5
+import marshmallow_dataclass
6
7
8
+class MyBaseSchema(marshmallow.Schema):
9
+ pass
10
11
12
+class A:
13
+ a: int
14
15
16
+# Top-level so that this is checked by mypy
17
+schema_with_base: MyBaseSchema = marshmallow_dataclass.class_schema(
18
+ A, base_schema=MyBaseSchema
19
+)()
20
21
+schema_without_base: marshmallow.Schema = marshmallow_dataclass.class_schema(A)()
22
23
24
+# Regression test for https://github.com/lovasoa/marshmallow_dataclass/pull/77
25
+class TestSchemaType(unittest.TestCase):
26
+ def test_custom_basechema_type(self):
27
+ self.assertIsInstance(schema_with_base, MyBaseSchema)
28
29
+ def test_no_basechema_type(self):
30
+ self.assertIsInstance(schema_without_base, marshmallow.Schema)
0 commit comments