File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
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 )
You can’t perform that action at this time.
0 commit comments