Skip to content

Commit 502ff6c

Browse files
author
Victor Stinner
committed
Issue python#10811: Use TestCase.assertRaises() in the new test
1 parent 8f9f8d6 commit 502ff6c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Lib/sqlite3/test/regression.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,10 @@ def foo():
298298
cur.execute("insert into a (bar) values (?)", (1,))
299299
yield 1
300300

301-
try:
302-
cur.executemany("insert into b (baz) values (?)", ((i,) for i in foo()))
303-
self.fail("should have raised ProgrammingError")
304-
except sqlite.ProgrammingError:
305-
pass
301+
with self.assertRaises(sqlite.ProgrammingError):
302+
cur.executemany("insert into b (baz) values (?)",
303+
((i,) for i in foo()))
304+
306305

307306
def suite():
308307
regression_suite = unittest.makeSuite(RegressionTests, "Check")

0 commit comments

Comments
 (0)