Skip to content

Commit a63fde1

Browse files
committed
Add (currently failing) tests for lovasoa#77
See python/mypy#4300
1 parent 6d6e2f6 commit a63fde1

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/test_schema_type.py

+30
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)