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

Method test_registration_builtins

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

Source from the content-addressed store, hash-verified

332 self.assertIsInstance(b, (A,))
333
334 def test_registration_builtins(self):
335 class A(metaclass=abc_ABCMeta):
336 pass
337 A.register(int)
338 self.assertIsInstance(42, A)
339 self.assertIsInstance(42, (A,))
340 self.assertIsSubclass(int, A)
341 self.assertIsSubclass(int, (A,))
342 class B(A):
343 pass
344 B.register(str)
345 class C(str): pass
346 self.assertIsInstance("", A)
347 self.assertIsInstance("", (A,))
348 self.assertIsSubclass(str, A)
349 self.assertIsSubclass(str, (A,))
350 self.assertIsSubclass(C, A)
351 self.assertIsSubclass(C, (A,))
352
353 def test_registration_edge_cases(self):
354 class A(metaclass=abc_ABCMeta):

Callers

nothing calls this directly

Calls 3

assertIsInstanceMethod · 0.80
registerMethod · 0.45
assertIsSubclassMethod · 0.45

Tested by

no test coverage detected