diff options
author | Christian Heimes <christian@cheimes.de> | 2008-03-03 19:18:51 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-03-03 19:18:51 (GMT) |
commit | be5b30b15f6ba8bb854968db3bd43390676b905b (patch) | |
tree | bc9f50a252ba8ad73136af4273222308a972d3c0 /Lib/test/test_abc.py | |
parent | 180510d29b369b88b0eb8815086162d2d6ef60a7 (diff) | |
download | cpython-be5b30b15f6ba8bb854968db3bd43390676b905b.zip cpython-be5b30b15f6ba8bb854968db3bd43390676b905b.tar.gz cpython-be5b30b15f6ba8bb854968db3bd43390676b905b.tar.bz2 |
Merged revisions 61203-61204 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61203 | christian.heimes | 2008-03-03 13:40:17 +0100 (Mon, 03 Mar 2008) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-60195" from
svn+ssh://pythondev@svn.python.org/python/branches/trunk-math
........
r61204 | christian.heimes | 2008-03-03 19:28:04 +0100 (Mon, 03 Mar 2008) | 1 line
Since abc._Abstract was replaces by a new type flags the regression test suite fails. I've added a new function inspect.isabstract(). Is the mmethod fine or should I check if object is a instance of type or subclass of object, too?
........
Diffstat (limited to 'Lib/test/test_abc.py')
-rw-r--r-- | Lib/test/test_abc.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py index 7a932fc..d631c3e 100644 --- a/Lib/test/test_abc.py +++ b/Lib/test/test_abc.py @@ -7,6 +7,7 @@ import unittest from test import test_support import abc +from inspect import isabstract class TestABC(unittest.TestCase): @@ -41,19 +42,23 @@ class TestABC(unittest.TestCase): def bar(self): pass # concrete self.assertEqual(C.__abstractmethods__, {"foo"}) self.assertRaises(TypeError, C) # because foo is abstract + self.assert_(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.assert_(isabstract(D)) class E(D): def foo(self): pass self.assertEqual(E.__abstractmethods__, set()) E() # now foo is concrete, too + self.failIf(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.assert_(isabstract(F)) def test_subclass_oldstyle_class(self): class A: |