summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_functools.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2010-11-20 19:04:17 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2010-11-20 19:04:17 (GMT)
commitb3aedd48621ed9d33b5f42f946b256bce4a50673 (patch)
tree2297c8ebce1b09621e1d98096c1603896d9a0f0c /Lib/test/test_functools.py
parentb8bc439b2093add9b313bcca2cc507a2d0e87764 (diff)
downloadcpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.zip
cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.tar.gz
cpython-b3aedd48621ed9d33b5f42f946b256bce4a50673.tar.bz2
#9424: Replace deprecated assert* methods in the Python test suite.
Diffstat (limited to 'Lib/test/test_functools.py')
-rw-r--r--Lib/test/test_functools.py66
1 files changed, 33 insertions, 33 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index 82ad889..65ef9b4 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -428,12 +428,12 @@ class TestTotalOrdering(unittest.TestCase):
self.value = value
def __lt__(self, other):
return self.value < other.value
- self.assert_(A(1) < A(2))
- self.assert_(A(2) > A(1))
- self.assert_(A(1) <= A(2))
- self.assert_(A(2) >= A(1))
- self.assert_(A(2) <= A(2))
- self.assert_(A(2) >= A(2))
+ self.assertTrue(A(1) < A(2))
+ self.assertTrue(A(2) > A(1))
+ self.assertTrue(A(1) <= A(2))
+ self.assertTrue(A(2) >= A(1))
+ self.assertTrue(A(2) <= A(2))
+ self.assertTrue(A(2) >= A(2))
def test_total_ordering_le(self):
@functools.total_ordering
@@ -442,12 +442,12 @@ class TestTotalOrdering(unittest.TestCase):
self.value = value
def __le__(self, other):
return self.value <= other.value
- self.assert_(A(1) < A(2))
- self.assert_(A(2) > A(1))
- self.assert_(A(1) <= A(2))
- self.assert_(A(2) >= A(1))
- self.assert_(A(2) <= A(2))
- self.assert_(A(2) >= A(2))
+ self.assertTrue(A(1) < A(2))
+ self.assertTrue(A(2) > A(1))
+ self.assertTrue(A(1) <= A(2))
+ self.assertTrue(A(2) >= A(1))
+ self.assertTrue(A(2) <= A(2))
+ self.assertTrue(A(2) >= A(2))
def test_total_ordering_gt(self):
@functools.total_ordering
@@ -456,12 +456,12 @@ class TestTotalOrdering(unittest.TestCase):
self.value = value
def __gt__(self, other):
return self.value > other.value
- self.assert_(A(1) < A(2))
- self.assert_(A(2) > A(1))
- self.assert_(A(1) <= A(2))
- self.assert_(A(2) >= A(1))
- self.assert_(A(2) <= A(2))
- self.assert_(A(2) >= A(2))
+ self.assertTrue(A(1) < A(2))
+ self.assertTrue(A(2) > A(1))
+ self.assertTrue(A(1) <= A(2))
+ self.assertTrue(A(2) >= A(1))
+ self.assertTrue(A(2) <= A(2))
+ self.assertTrue(A(2) >= A(2))
def test_total_ordering_ge(self):
@functools.total_ordering
@@ -470,24 +470,24 @@ class TestTotalOrdering(unittest.TestCase):
self.value = value
def __ge__(self, other):
return self.value >= other.value
- self.assert_(A(1) < A(2))
- self.assert_(A(2) > A(1))
- self.assert_(A(1) <= A(2))
- self.assert_(A(2) >= A(1))
- self.assert_(A(2) <= A(2))
- self.assert_(A(2) >= A(2))
+ self.assertTrue(A(1) < A(2))
+ self.assertTrue(A(2) > A(1))
+ self.assertTrue(A(1) <= A(2))
+ self.assertTrue(A(2) >= A(1))
+ self.assertTrue(A(2) <= A(2))
+ self.assertTrue(A(2) >= A(2))
def test_total_ordering_no_overwrite(self):
# new methods should not overwrite existing
@functools.total_ordering
class A(int):
pass
- self.assert_(A(1) < A(2))
- self.assert_(A(2) > A(1))
- self.assert_(A(1) <= A(2))
- self.assert_(A(2) >= A(1))
- self.assert_(A(2) <= A(2))
- self.assert_(A(2) >= A(2))
+ self.assertTrue(A(1) < A(2))
+ self.assertTrue(A(2) > A(1))
+ self.assertTrue(A(1) <= A(2))
+ self.assertTrue(A(2) >= A(1))
+ self.assertTrue(A(2) <= A(2))
+ self.assertTrue(A(2) >= A(2))
def test_no_operations_defined(self):
with self.assertRaises(ValueError):
@@ -507,9 +507,9 @@ class TestLRU(unittest.TestCase):
x, y = choice(domain), choice(domain)
actual = f(x, y)
expected = orig(x, y)
- self.assertEquals(actual, expected)
- self.assert_(f.cache_hits > f.cache_misses)
- self.assertEquals(f.cache_hits + f.cache_misses, 1000)
+ self.assertEqual(actual, expected)
+ self.assertTrue(f.cache_hits > f.cache_misses)
+ self.assertEqual(f.cache_hits + f.cache_misses, 1000)
f.cache_clear() # test clearing
self.assertEqual(f.cache_hits, 0)