Changeset 391 for python/trunk/Lib/sqlite3/test/transactions.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/transactions.py
r2 r391 60 60 self.cur2.execute("select i from test") 61 61 res = self.cur2.fetchall() 62 self. failUnlessEqual(len(res), 1)62 self.assertEqual(len(res), 1) 63 63 64 64 def CheckInsertStartsTransaction(self): … … 67 67 self.cur2.execute("select i from test") 68 68 res = self.cur2.fetchall() 69 self. failUnlessEqual(len(res), 0)69 self.assertEqual(len(res), 0) 70 70 71 71 def CheckUpdateStartsTransaction(self): … … 76 76 self.cur2.execute("select i from test") 77 77 res = self.cur2.fetchone()[0] 78 self. failUnlessEqual(res, 5)78 self.assertEqual(res, 5) 79 79 80 80 def CheckDeleteStartsTransaction(self): … … 85 85 self.cur2.execute("select i from test") 86 86 res = self.cur2.fetchall() 87 self. failUnlessEqual(len(res), 1)87 self.assertEqual(len(res), 1) 88 88 89 89 def CheckReplaceStartsTransaction(self): … … 94 94 self.cur2.execute("select i from test") 95 95 res = self.cur2.fetchall() 96 self. failUnlessEqual(len(res), 1)97 self. failUnlessEqual(res[0][0], 5)96 self.assertEqual(len(res), 1) 97 self.assertEqual(res[0][0], 5) 98 98 99 99 def CheckToggleAutoCommit(self): … … 101 101 self.cur1.execute("insert into test(i) values (5)") 102 102 self.con1.isolation_level = None 103 self. failUnlessEqual(self.con1.isolation_level, None)104 self.cur2.execute("select i from test") 105 res = self.cur2.fetchall() 106 self. failUnlessEqual(len(res), 1)103 self.assertEqual(self.con1.isolation_level, None) 104 self.cur2.execute("select i from test") 105 res = self.cur2.fetchall() 106 self.assertEqual(len(res), 1) 107 107 108 108 self.con1.isolation_level = "DEFERRED" 109 self. failUnlessEqual(self.con1.isolation_level , "DEFERRED")110 self.cur1.execute("insert into test(i) values (5)") 111 self.cur2.execute("select i from test") 112 res = self.cur2.fetchall() 113 self. failUnlessEqual(len(res), 1)109 self.assertEqual(self.con1.isolation_level , "DEFERRED") 110 self.cur1.execute("insert into test(i) values (5)") 111 self.cur2.execute("select i from test") 112 res = self.cur2.fetchall() 113 self.assertEqual(len(res), 1) 114 114 115 115 def CheckRaiseTimeout(self): … … 149 149 self.con1.commit() 150 150 151 def CheckRollbackCursorConsistency(self): 152 """ 153 Checks if cursors on the connection are set into a "reset" state 154 when a rollback is done on the connection. 155 """ 156 con = sqlite.connect(":memory:") 157 cur = con.cursor() 158 cur.execute("create table test(x)") 159 cur.execute("insert into test(x) values (5)") 160 cur.execute("select 1 union select 2 union select 3") 161 162 con.rollback() 163 try: 164 cur.fetchall() 165 self.fail("InterfaceError should have been raised") 166 except sqlite.InterfaceError, e: 167 pass 168 except: 169 self.fail("InterfaceError should have been raised") 170 151 171 class SpecialCommandTests(unittest.TestCase): 152 172 def setUp(self):
Note:
See TracChangeset
for help on using the changeset viewer.