diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-10-02 17:55:47 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-10-02 17:55:47 (GMT) |
commit | 970d1887c540d03d51e15db1173d3959acdd8e51 (patch) | |
tree | 34d3c8e211da52e40cef4a90a48379353514d05c /Lib/test/test_abc.py | |
parent | 5397e862e2bae29b278cf8756761764e06441db4 (diff) | |
download | cpython-970d1887c540d03d51e15db1173d3959acdd8e51.zip cpython-970d1887c540d03d51e15db1173d3959acdd8e51.tar.gz cpython-970d1887c540d03d51e15db1173d3959acdd8e51.tar.bz2 |
add a test and a note about metaclasses now being abcs
Diffstat (limited to 'Lib/test/test_abc.py')
-rw-r--r-- | Lib/test/test_abc.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py index 3a1d76b..1b51644 100644 --- a/Lib/test/test_abc.py +++ b/Lib/test/test_abc.py @@ -105,6 +105,19 @@ class TestABC(unittest.TestCase): pass self.assertRaises(AttributeError, getattr, meta, "__abstractmethods__") + def test_metaclass_abc(self): + # Metaclasses can be ABCs, too. + class A(metaclass=abc.ABCMeta): + @abc.abstractmethod + def x(self): + pass + self.assertEqual(A.__abstractmethods__, {"x"}) + class meta(type, A): + def x(self): + return 1 + class C(metaclass=meta): + pass + def test_registration_basics(self): class A(metaclass=abc.ABCMeta): pass |