MCPcopy Create free account
hub / github.com/rthalley/dnspython / make_classes

Method make_classes

tests/test_immutable.py:44–89  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

42 immutable_module = dns._immutable_ctx
43
44 def make_classes(self):
45 class A:
46 def __init__(self, a, akw=10):
47 self.a = a
48 self.akw = akw
49
50 class B(A):
51 def __init__(self, a, b):
52 super().__init__(a, akw=20)
53 self.b = b
54
55 B = self.immutable_module.immutable(B)
56
57 # note C is immutable by inheritance
58 class C(B):
59 def __init__(self, a, b, c):
60 super().__init__(a, b)
61 self.c = c
62
63 C = self.immutable_module.immutable(C)
64
65 class SA:
66 __slots__ = ("a", "akw")
67
68 def __init__(self, a, akw=10):
69 self.a = a
70 self.akw = akw
71
72 class SB(A):
73 __slots__ = "b"
74
75 def __init__(self, a, b):
76 super().__init__(a, akw=20)
77 self.b = b
78
79 SB = self.immutable_module.immutable(SB)
80
81 # note SC is immutable by inheritance and has no slots of its own
82 class SC(SB):
83 def __init__(self, a, b, c):
84 super().__init__(a, b)
85 self.c = c
86
87 SC = self.immutable_module.immutable(SC)
88
89 return ((A, B, C), (SA, SB, SC))
90
91 def test_basic(self):
92 for A, B, C in self.make_classes():

Callers 1

test_basicMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected