| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f5b1af6 commit 48b5c98
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -335,8 +335,7 @@ def CheckRowcountExecutemany(self): | |||
| 335 | 335 | def CheckTotalChanges(self): | |
| 336 | 336 | self.cu.execute("insert into test(name) values ('foo')") | |
| 337 | 337 | self.cu.execute("insert into test(name) values ('foo')") | |
| 338 | - if self.cx.total_changes < 2: | ||
| 339 | - self.fail("total changes reported wrong value") | ||
| 338 | + self.assertLess(2, self.cx.total_changes, msg='total changes reported wrong value') | ||
| 340 | 339 | ||
| 341 | 340 | # Checks for executemany: | |
| 342 | 341 | # Sequences are required by the DB-API, iterators | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,8 +61,8 @@ def mycoll(x, y): | |||
| 61 | 61 | ) order by x collate mycoll | |
| 62 | 62 | """ | |
| 63 | 63 | result = con.execute(sql).fetchall() | |
| 64 | - if result[0][0] != "c" or result[1][0] != "b" or result[2][0] != "a": | ||
| 65 | - self.fail("the expected order was not returned") | ||
| 64 | + self.assertEqual(result, [('c',), ('b',), ('a',)], | ||
| 65 | + msg='the expected order was not returned') | ||
| 66 | 66 | ||
| 67 | 67 | con.create_collation("mycoll", None) | |
| 68 | 68 | with self.assertRaises(sqlite.OperationalError) as cm: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -134,17 +134,11 @@ def CheckTypeMapUsage(self): | |||
| 134 | 134 | def CheckErrorMsgDecodeError(self): | |
| 135 | 135 | # When porting the module to Python 3.0, the error message about | |
| 136 | 136 | # decoding errors disappeared. This verifies they're back again. | |
| 137 | - failure = None | ||
| 138 | - try: | ||
| 137 | + with self.assertRaises(sqlite.OperationalError) as cm: | ||
| 139 | 138 | self.con.execute("select 'xxx' || ? || 'yyy' colname", | |
| 140 | 139 | (bytes(bytearray([250])),)).fetchone() | |
| 141 | - failure = "should have raised an OperationalError with detailed description" | ||
| 142 | - except sqlite.OperationalError as e: | ||
| 143 | - msg = e.args[0] | ||
| 144 | - if not msg.startswith("Could not decode to UTF-8 column 'colname' with text 'xxx"): | ||
| 145 | - failure = "OperationalError did not have expected description text" | ||
| 146 | - if failure: | ||
| 147 | - self.fail(failure) | ||
| 140 | + msg = "Could not decode to UTF-8 column 'colname' with text 'xxx" | ||
| 141 | + self.assertIn(msg, str(cm.exception)) | ||
| 148 | 142 | ||
| 149 | 143 | def CheckRegisterAdapter(self): | |
| 150 | 144 | """ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments