diff options
| author | Guido van Rossum <guido@python.org> | 2007-11-22 00:55:51 (GMT) |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 2007-11-22 00:55:51 (GMT) |
| commit | 64c06e327d48150fc548cf18a4a7ae0b890e69fa (patch) | |
| tree | daf53ab57c369a3d92c5a9deafc41df2ccd96127 /Lib/test/test_abc.py | |
| parent | cc7f26bf207ee17e2c1b3e6545e145942aff612d (diff) | |
| download | cpython-64c06e327d48150fc548cf18a4a7ae0b890e69fa.zip cpython-64c06e327d48150fc548cf18a4a7ae0b890e69fa.tar.gz cpython-64c06e327d48150fc548cf18a4a7ae0b890e69fa.tar.bz2 | |
Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
With some changes of my own thrown in (e.g. backport of r58107).
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 3fd9bde..c760356 100644 --- a/Lib/test/test_abc.py +++ b/Lib/test/test_abc.py @@ -133,6 +133,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 + class B: + counter = 0 + def __new__(cls): + B.counter += 1 + return super(B, cls).__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) |
