We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c58f78 commit bdff0ebCopy full SHA for bdff0eb
tests/test_validated_dataclass.py
@@ -0,0 +1,26 @@
1
+from unittest import TestCase, main
2
+
3
+from zenlib.types import validatedDataclass
4
5
6
+@validatedDataclass
7
+class testDataClass:
8
+ a: int = None
9
+ b: str = None
10
11
12
+class TestValidatedDataclass(TestCase):
13
+ def test_validated_dataclass(self):
14
+ c = testDataClass()
15
+ c.a = 1
16
+ c.b = "test"
17
+ self.assertTrue(hasattr(c, "logger"))
18
19
+ def test_bad_type(self):
20
21
+ with self.assertRaises(TypeError):
22
+ c.a = "test"
23
24
25
+if __name__ == "__main__":
26
+ main()
0 commit comments