MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_registration_basics

Method test_registration_basics

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected