Changeset 391 for python/trunk/Lib/sqlite3/test/hooks.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/sqlite3/test/hooks.py
r2 r391 38 38 self.fail("should have raised a TypeError") 39 39 except TypeError, e: 40 self. failUnlessEqual(e.args[0], "parameter must be callable")40 self.assertEqual(e.args[0], "parameter must be callable") 41 41 42 42 def CheckCreateCollationNotAscii(self): … … 75 75 self.fail("should have raised an OperationalError") 76 76 except sqlite.OperationalError, e: 77 self.failUnlessEqual(e.args[0].lower(), "no such collation sequence: mycoll") 77 self.assertEqual(e.args[0].lower(), "no such collation sequence: mycoll") 78 79 def CheckCollationReturnsLargeInteger(self): 80 def mycoll(x, y): 81 # reverse order 82 return -((x > y) - (x < y)) * 2**32 83 con = sqlite.connect(":memory:") 84 con.create_collation("mycoll", mycoll) 85 sql = """ 86 select x from ( 87 select 'a' as x 88 union 89 select 'b' as x 90 union 91 select 'c' as x 92 ) order by x collate mycoll 93 """ 94 result = con.execute(sql).fetchall() 95 self.assertEqual(result, [('c',), ('b',), ('a',)], 96 msg="the expected order was not returned") 78 97 79 98 def CheckCollationRegisterTwice(self): … … 120 139 create table foo(a, b) 121 140 """) 122 self. failUnless(progress_calls)141 self.assertTrue(progress_calls) 123 142 124 143 … … 144 163 """) 145 164 second_count = len(progress_calls) 146 self. failUnless(first_count > second_count)165 self.assertTrue(first_count > second_count) 147 166 148 167 def CheckCancelOperation(self): … … 167 186 """ 168 187 con = sqlite.connect(":memory:") 169 action = 0170 def progress(): 171 action = 1188 action = [] 189 def progress(): 190 action.append(1) 172 191 return 0 173 192 con.set_progress_handler(progress, 1) 174 193 con.set_progress_handler(None, 1) 175 194 con.execute("select 1 union select 2 union select 3").fetchall() 176 self. failUnlessEqual(action, 0, "progress handler was not cleared")195 self.assertEqual(len(action), 0, "progress handler was not cleared") 177 196 178 197 def suite():
Note:
See TracChangeset
for help on using the changeset viewer.