8000 bpo-41905: added abc.update_abstractmethods by bentheiii · Pull Request #22485 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-41905: added abc.update_abstractmethods #22485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Oct 6, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added layered test case
  • Loading branch information
ben avrahami committed Oct 4, 2020
commit ba8df080f0f4ccb092e73d13098b6a6cf675c6e0
22 changes: 22 additions & 0 deletions Lib/test/test_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,28 @@ def foo(self):
msg = "class B with abstract method foo"
self.assertRaisesRegex(TypeError, msg, B)

def test_update_layered_implementation(self):
class A(metaclass=abc_ABCMeta):
@abc.abstractmethod
def foo(self):
pass

class B(A):
pass

class C(B):
def foo(self):
pass

C()

del C.foo

abc.update_abstractmethods(C)

msg = "class C with abstract method foo"
self.assertRaisesRegex(TypeError, msg, C)



class TestABCWithInitSubclass(unittest.TestCase):
Expand Down
0