summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_abc.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-08-08 16:37:52 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-08-08 16:37:52 (GMT)
commite1a6edcebe32deca486d976b61ab9f8e403d31d9 (patch)
tree855707f9c9860353a280dcd22a1ad69478375a93 /Lib/test/test_abc.py
parent0738aff368103359fa784b9c789b33d7e324312b (diff)
parent4e4f3b8d353803003c5f114a29f3b0ab1596fe24 (diff)
downloadcpython-e1a6edcebe32deca486d976b61ab9f8e403d31d9.zip
cpython-e1a6edcebe32deca486d976b61ab9f8e403d31d9.tar.gz
cpython-e1a6edcebe32deca486d976b61ab9f8e403d31d9.tar.bz2
#18581: merge with 3.3.
Diffstat (limited to 'Lib/test/test_abc.py')
-rw-r--r--Lib/test/test_abc.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index 4b15157..93f9dae 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -65,34 +65,6 @@ class TestLegacyAPI(unittest.TestCase):
self.assertEqual(D.foo(), 4)
self.assertEqual(D().foo(), 4)
- def test_abstractmethod_integration(self):
- for abstractthing in [abc.abstractmethod, abc.abstractproperty,
- abc.abstractclassmethod,
- abc.abstractstaticmethod]:
- class C(metaclass=abc.ABCMeta):
- @abstractthing
- def foo(self): pass # abstract
- def bar(self): pass # concrete
- self.assertEqual(C.__abstractmethods__, {"foo"})
- self.assertRaises(TypeError, C) # because foo is abstract
- self.assertTrue(isabstract(C))
- class D(C):
- def bar(self): pass # concrete override of concrete
- self.assertEqual(D.__abstractmethods__, {"foo"})
- self.assertRaises(TypeError, D) # because foo is still abstract
- self.assertTrue(isabstract(D))
- class E(D):
- def foo(self): pass
- self.assertEqual(E.__abstractmethods__, set())
- E() # now foo is concrete, too
- self.assertFalse(isabstract(E))
- class F(E):
- @abstractthing
- def bar(self): pass # abstract override of concrete
- self.assertEqual(F.__abstractmethods__, {"bar"})
- self.assertRaises(TypeError, F) # because bar is abstract now
- self.assertTrue(isabstract(F))
-
class TestABC(unittest.TestCase):
@@ -432,9 +404,5 @@ class TestABC(unittest.TestCase):
self.assertEqual(B.counter, 1)
-def test_main():
- support.run_unittest(TestABC)
-
-
if __name__ == "__main__":
unittest.main()