MCPcopy Index your code
hub / github.com/python/cpython / test_register_as_class_deco

Method test_register_as_class_deco

Lib/test/test_abc.py:297–316  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

295 self.assertIsInstance(c, (A,))
296
297 def test_register_as_class_deco(self):
298 class A(metaclass=abc_ABCMeta):
299 pass
300 @A.register
301 class B(object):
302 pass
303 b = B()
304 self.assertIsSubclass(B, A)
305 self.assertIsSubclass(B, (A,))
306 self.assertIsInstance(b, A)
307 self.assertIsInstance(b, (A,))
308 @A.register
309 class C(B):
310 pass
311 c = C()
312 self.assertIsSubclass(C, A)
313 self.assertIsSubclass(C, (A,))
314 self.assertIsInstance(c, A)
315 self.assertIsInstance(c, (A,))
316 self.assertIs(C, A.register(C))
317
318 def test_isinstance_invalidation(self):
319 class A(metaclass=abc_ABCMeta):

Callers

nothing calls this directly

Calls 6

assertIsSubclassMethod · 0.80
assertIsInstanceMethod · 0.80
BClass · 0.70
CClass · 0.70
assertIsMethod · 0.45
registerMethod · 0.45

Tested by

no test coverage detected