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

Method test_update_implementation

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

Source from the content-addressed store, hash-verified

540 self.assertRaisesRegex(TypeError, msg, A)
541
542 def test_update_implementation(self):
543 class A(metaclass=abc_ABCMeta):
544 @abc.abstractmethod
545 def foo(self):
546 pass
547
548 class B(A):
549 pass
550
551 msg = "class B without an implementation for abstract method 'foo'"
552 self.assertRaisesRegex(TypeError, msg, B)
553 self.assertEqual(B.__abstractmethods__, {'foo'})
554
555 B.foo = lambda self: None
556
557 abc.update_abstractmethods(B)
558
559 B()
560 self.assertEqual(B.__abstractmethods__, set())
561
562 def test_update_as_decorator(self):
563 class A(metaclass=abc_ABCMeta):

Callers

nothing calls this directly

Calls 4

setFunction · 0.85
assertRaisesRegexMethod · 0.80
BClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected