Issue #10811: Use TestCase.assertRaises() in the new test

This commit is contained in:
Victor Stinner 2011-05-09 12:50:41 +02:00
parent 8f9f8d612a
commit 502ff6c920
1 changed files with 4 additions and 5 deletions

View File

@ -298,11 +298,10 @@ class RegressionTests(unittest.TestCase):
cur.execute("insert into a (bar) values (?)", (1,))
yield 1
try:
cur.executemany("insert into b (baz) values (?)", ((i,) for i in foo()))
self.fail("should have raised ProgrammingError")
except sqlite.ProgrammingError:
pass
with self.assertRaises(sqlite.ProgrammingError):
cur.executemany("insert into b (baz) values (?)",
((i,) for i in foo()))
def suite():
regression_suite = unittest.makeSuite(RegressionTests, "Check")