summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_copy.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-01-27 18:17:45 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-01-27 18:17:45 (GMT)
commita56c467ac39ab1a6a2e9dc2fa41a9f573f989839 (patch)
treef65fc7d2a4359328f10c1dd9122a692e78e71e8a /Lib/test/test_copy.py
parent191e850053128f726d6562e1d8306dfe5e4aa8aa (diff)
downloadcpython-a56c467ac39ab1a6a2e9dc2fa41a9f573f989839.zip
cpython-a56c467ac39ab1a6a2e9dc2fa41a9f573f989839.tar.gz
cpython-a56c467ac39ab1a6a2e9dc2fa41a9f573f989839.tar.bz2
Issue #1717: Remove cmp. Stage 1: remove all uses of cmp and __cmp__ from
the standard library and tests.
Diffstat (limited to 'Lib/test/test_copy.py')
-rw-r--r--Lib/test/test_copy.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index 500fa83..133c888 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -2,10 +2,14 @@
import copy
import copyreg
-
+from operator import le, lt, ge, gt, eq, ne
import unittest
from test import support
+order_comparisons = le, lt, ge, gt
+equality_comparisons = eq, ne
+comparisons = order_comparisons + equality_comparisons
+
class TestCopy(unittest.TestCase):
# Attempt full line coverage of copy.py from top to bottom
@@ -271,7 +275,8 @@ class TestCopy(unittest.TestCase):
x = []
x.append(x)
y = copy.deepcopy(x)
- self.assertRaises(RuntimeError, cmp, y, x)
+ for op in comparisons:
+ self.assertRaises(RuntimeError, op, y, x)
self.assert_(y is not x)
self.assert_(y[0] is y)
self.assertEqual(len(y), 1)
@@ -287,7 +292,8 @@ class TestCopy(unittest.TestCase):
x = ([],)
x[0].append(x)
y = copy.deepcopy(x)
- self.assertRaises(RuntimeError, cmp, y, x)
+ for op in comparisons:
+ self.assertRaises(RuntimeError, op, y, x)
self.assert_(y is not x)
self.assert_(y[0] is not x[0])
self.assert_(y[0][0] is y)
@@ -303,7 +309,10 @@ class TestCopy(unittest.TestCase):
x = {}
x['foo'] = x
y = copy.deepcopy(x)
- self.assertRaises(TypeError, cmp, y, x)
+ for op in order_comparisons:
+ self.assertRaises(TypeError, op, y, x)
+ for op in equality_comparisons:
+ self.assertRaises(RuntimeError, op, y, x)
self.assert_(y is not x)
self.assert_(y['foo'] is y)
self.assertEqual(len(y), 1)