diff options
author | Guido van Rossum <guido@python.org> | 2007-09-11 20:42:30 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-09-11 20:42:30 (GMT) |
commit | 894d35ea61c24c09f5d8d15683904d6aba27fab4 (patch) | |
tree | d9e0eab97d665641d033be88d5cc7cfe5112d6c0 /Lib/test/test_abc.py | |
parent | 1ba3114fdb5adb5e6852c85e1d3caccba3395471 (diff) | |
download | cpython-894d35ea61c24c09f5d8d15683904d6aba27fab4.zip cpython-894d35ea61c24c09f5d8d15683904d6aba27fab4.tar.gz cpython-894d35ea61c24c09f5d8d15683904d6aba27fab4.tar.bz2 |
Thomas Wouters pointed out that _Abstract.__new__ should use super().__new__()
instead of going straight to object.__new__().
Diffstat (limited to 'Lib/test/test_abc.py')
-rw-r--r-- | Lib/test/test_abc.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py index f93f3d3..008d839 100644 --- a/Lib/test/test_abc.py +++ b/Lib/test/test_abc.py @@ -130,6 +130,20 @@ class TestABC(unittest.TestCase): self.failUnless(issubclass(MyInt, A)) self.failUnless(isinstance(42, A)) + def test_all_new_methods_are_called(self): + class A(metaclass=abc.ABCMeta): + pass + class B: + counter = 0 + def __new__(cls): + B.counter += 1 + return super().__new__(cls) + class C(A, B): + pass + self.assertEqual(B.counter, 0) + C() + self.assertEqual(B.counter, 1) + def test_main(): test_support.run_unittest(TestABC) |