summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_abc.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-07 17:19:16 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-07 17:19:16 (GMT)
commit043d6f67c7b79a6d268c6ad31d8ff7710ac3e5ee (patch)
tree0ea113cd3a06b4ecbb27a82154174e1846ce1804 /Lib/test/test_abc.py
parent13a7a21258f0cd241c2cf1367a954d6742daa2a6 (diff)
downloadcpython-043d6f67c7b79a6d268c6ad31d8ff7710ac3e5ee.zip
cpython-043d6f67c7b79a6d268c6ad31d8ff7710ac3e5ee.tar.gz
cpython-043d6f67c7b79a6d268c6ad31d8ff7710ac3e5ee.tar.bz2
Copied doc for reload() from trunk's function.rst to imp.rst
Diffstat (limited to 'Lib/test/test_abc.py')
-rw-r--r--Lib/test/test_abc.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index e6c8415..884dd32 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -56,10 +56,18 @@ class TestABC(unittest.TestCase):
self.assertEqual(F.__abstractmethods__, {"bar"})
self.assertRaises(TypeError, F) # because bar is abstract now
+ def test_subclass_oldstyle_class(self):
+ class A:
+ __metaclass__ = abc.ABCMeta
+ class OldstyleClass:
+ pass
+ self.assertFalse(issubclass(OldstyleClass, A))
+ self.assertFalse(issubclass(A, OldstyleClass))
+
def test_registration_basics(self):
class A(metaclass=abc.ABCMeta):
pass
- class B:
+ class B(object):
pass
b = B()
self.assertEqual(issubclass(B, A), False)
@@ -94,7 +102,7 @@ class TestABC(unittest.TestCase):
class A1(A):
pass
self.assertRaises(RuntimeError, A1.register, A) # cycles not allowed
- class B:
+ class B(object):
pass
A1.register(B) # ok
A1.register(B) # should pass silently
@@ -135,7 +143,7 @@ class TestABC(unittest.TestCase):
def test_all_new_methods_are_called(self):
class A(metaclass=abc.ABCMeta):
pass
- class B:
+ class B(object):
counter = 0
def __new__(cls):
B.counter += 1