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/sqlite3/test/hooks.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/sqlite3/test/hooks.py')
-rw-r--r-- | Lib/sqlite3/test/hooks.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py index 6872fd6..c15c7be 100644 --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -42,7 +42,7 @@ class CollationTests(unittest.TestCase): def CheckCreateCollationNotAscii(self): con = sqlite.connect(":memory:") try: - con.create_collation("collä", cmp) + con.create_collation("collä", lambda x, y: (x > y) - (x < y)) self.fail("should have raised a ProgrammingError") except sqlite.ProgrammingError as e: pass @@ -52,7 +52,7 @@ class CollationTests(unittest.TestCase): return def mycoll(x, y): # reverse order - return -cmp(x, y) + return -((x > y) - (x < y)) con = sqlite.connect(":memory:") con.create_collation("mycoll", mycoll) @@ -82,8 +82,8 @@ class CollationTests(unittest.TestCase): Verify that the last one is actually used. """ con = sqlite.connect(":memory:") - con.create_collation("mycoll", cmp) - con.create_collation("mycoll", lambda x, y: -cmp(x, y)) + con.create_collation("mycoll", lambda x, y: (x > y) - (x < y)) + con.create_collation("mycoll", lambda x, y: -((x > y) - (x < y))) result = con.execute(""" select x from (select 'a' as x union select 'b' as x) order by x collate mycoll """).fetchall() @@ -96,7 +96,7 @@ class CollationTests(unittest.TestCase): to use it. """ con = sqlite.connect(":memory:") - con.create_collation("mycoll", cmp) + con.create_collation("mycoll", lambda x, y: (x > y) - (x < y)) con.create_collation("mycoll", None) try: con.execute("select 'a' as x union select 'b' as x order by x collate mycoll") |