diff Lib/sqlite3/test/hooks.py @ 51122:adbd77a90bde 3.0

Merged revisions 69025 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r69025 | mark.dickinson | 2009-01-27 18:17:45 +0000 (Tue, 27 Jan 2009) | 3 lines Issue #1717: Remove cmp. Stage 1: remove all uses of cmp and __cmp__ from the standard library and tests. ........
author Mark Dickinson <dickinsm@gmail.com>
date Tue, 27 Jan 2009 18:31:30 +0000
parents e06e08e8fdce
children 680ad8eed33b
line wrap: on
line diff
--- a/Lib/sqlite3/test/hooks.py	Tue Jan 27 11:04:59 2009 +0000
+++ b/Lib/sqlite3/test/hooks.py	Tue Jan 27 18:31:30 2009 +0000
@@ -42,7 +42,7 @@
     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 @@
             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 @@
         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 @@
         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")