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

Method test_registration_basics

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

Source from the content-addressed store, hash-verified

271 pass
272
273 def test_registration_basics(self):
274 class A(metaclass=abc_ABCMeta):
275 pass
276 class B(object):
277 pass
278 b = B()
279 self.assertNotIsSubclass(B, A)
280 self.assertNotIsSubclass(B, (A,))
281 self.assertNotIsInstance(b, A)
282 self.assertNotIsInstance(b, (A,))
283 B1 = A.register(B)
284 self.assertIsSubclass(B, A)
285 self.assertIsSubclass(B, (A,))
286 self.assertIsInstance(b, A)
287 self.assertIsInstance(b, (A,))
288 self.assertIs(B1, B)
289 class C(B):
290 pass
291 c = C()
292 self.assertIsSubclass(C, A)
293 self.assertIsSubclass(C, (A,))
294 self.assertIsInstance(c, A)
295 self.assertIsInstance(c, (A,))
296
297 def test_register_as_class_deco(self):
298 class A(metaclass=abc_ABCMeta):

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected