Merged revisions 84125-84126 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84125 | benjamin.peterson | 2010-08-16 20:07:53 -0500 (Mon, 16 Aug 2010) | 1 line
use assertTrue/assertFalse
........
r84126 | benjamin.peterson | 2010-08-16 20:08:46 -0500 (Mon, 16 Aug 2010) | 1 line
remove test for oldstyle classes
........
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index 51fd9bb..f43123f 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -15,16 +15,16 @@
def test_abstractmethod_basics(self):
@abc.abstractmethod
def foo(self): pass
- self.assertEqual(foo.__isabstractmethod__, True)
+ self.assertTrue(foo.__isabstractmethod__)
def bar(self): pass
- self.assertEqual(hasattr(bar, "__isabstractmethod__"), False)
+ self.assertFalse(hasattr(bar, "__isabstractmethod__"))
def test_abstractproperty_basics(self):
@abc.abstractproperty
def foo(self): pass
- self.assertEqual(foo.__isabstractmethod__, True)
+ self.assertTrue(foo.__isabstractmethod__)
def bar(self): pass
- self.assertEqual(hasattr(bar, "__isabstractmethod__"), False)
+ self.assertFalse(hasattr(bar, "__isabstractmethod__"))
class C(metaclass=abc.ABCMeta):
@abc.abstractproperty
@@ -60,34 +60,26 @@
self.assertRaises(TypeError, F) # because bar is abstract now
self.assertTrue(isabstract(F))
- 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(object):
pass
b = B()
- self.assertEqual(issubclass(B, A), False)
- self.assertEqual(issubclass(B, (A,)), False)
+ self.assertFalse(issubclass(B, A))
+ self.assertFalse(issubclass(B, (A,)))
self.assertEqual(isinstance(b, A), False)
self.assertEqual(isinstance(b, (A,)), False)
A.register(B)
- self.assertEqual(issubclass(B, A), True)
- self.assertEqual(issubclass(B, (A,)), True)
+ self.assertTrue(issubclass(B, A))
+ self.assertTrue(issubclass(B, (A,)))
self.assertEqual(isinstance(b, A), True)
self.assertEqual(isinstance(b, (A,)), True)
class C(B):
pass
c = C()
- self.assertEqual(issubclass(C, A), True)
- self.assertEqual(issubclass(C, (A,)), True)
+ self.assertTrue(issubclass(C, A))
+ self.assertTrue(issubclass(C, (A,)))
self.assertEqual(isinstance(c, A), True)
self.assertEqual(isinstance(c, (A,)), True)
@@ -97,11 +89,11 @@
class B:
pass
b = B()
- self.assertEqual(isinstance(b, A), False)
- self.assertEqual(isinstance(b, (A,)), False)
+ self.assertFalse(isinstance(b, A))
+ self.assertFalse(isinstance(b, (A,)))
A.register(B)
- self.assertEqual(isinstance(b, A), True)
- self.assertEqual(isinstance(b, (A,)), True)
+ self.assertTrue(isinstance(b, A))
+ self.assertTrue(isinstance(b, (A,)))
def test_registration_builtins(self):
class A(metaclass=abc.ABCMeta):
@@ -109,18 +101,18 @@
A.register(int)
self.assertEqual(isinstance(42, A), True)
self.assertEqual(isinstance(42, (A,)), True)
- self.assertEqual(issubclass(int, A), True)
- self.assertEqual(issubclass(int, (A,)), True)
+ self.assertTrue(issubclass(int, A))
+ self.assertTrue(issubclass(int, (A,)))
class B(A):
pass
B.register(str)
class C(str): pass
self.assertEqual(isinstance("", A), True)
self.assertEqual(isinstance("", (A,)), True)
- self.assertEqual(issubclass(str, A), True)
- self.assertEqual(issubclass(str, (A,)), True)
- self.assertEqual(issubclass(C, A), True)
- self.assertEqual(issubclass(C, (A,)), True)
+ self.assertTrue(issubclass(str, A))
+ self.assertTrue(issubclass(str, (A,)))
+ self.assertTrue(issubclass(C, A))
+ self.assertTrue(issubclass(C, (A,)))
def test_registration_edge_cases(self):
class A(metaclass=abc.ABCMeta):