diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-01-27 18:17:45 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-01-27 18:17:45 (GMT) |
commit | a56c467ac39ab1a6a2e9dc2fa41a9f573f989839 (patch) | |
tree | f65fc7d2a4359328f10c1dd9122a692e78e71e8a /Lib/test/test_builtin.py | |
parent | 191e850053128f726d6562e1d8306dfe5e4aa8aa (diff) | |
download | cpython-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_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 7175b80..99785dc 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -10,6 +10,7 @@ warnings.filterwarnings("ignore", "hex../oct.. of negative int", FutureWarning, __name__) warnings.filterwarnings("ignore", "integer argument expected", DeprecationWarning, "unittest") +import builtins class Squares: @@ -219,21 +220,9 @@ class BuiltinTest(unittest.TestCase): self.assertRaises((OverflowError, ValueError), chr, 2**32) def test_cmp(self): - self.assertEqual(cmp(-1, 1), -1) - self.assertEqual(cmp(1, -1), 1) - self.assertEqual(cmp(1, 1), 0) - # verify that circular objects are not handled - a = []; a.append(a) - b = []; b.append(b) - from collections import UserList - c = UserList(); c.append(c) - self.assertRaises(RuntimeError, cmp, a, b) - self.assertRaises(RuntimeError, cmp, b, c) - self.assertRaises(RuntimeError, cmp, c, a) - self.assertRaises(RuntimeError, cmp, a, c) - # okay, now break the cycles - a.pop(); b.pop(); c.pop() - self.assertRaises(TypeError, cmp) + # uncomment the following line once cmp has been removed + #self.assert_(not hasattr(builtins, "cmp")) + pass def test_compile(self): compile('print(1)\n', '', 'exec') @@ -736,10 +725,6 @@ class BuiltinTest(unittest.TestCase): def __getitem__(self, index): raise ValueError self.assertRaises(ValueError, min, BadSeq()) - class BadNumber: - def __cmp__(self, other): - raise ValueError - self.assertRaises(TypeError, min, (42, BadNumber())) for stmt in ( "min(key=int)", # no args |