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

Method test_register_as_class_deco

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected