diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-06-12 22:35:10 +0300 |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-06-12 22:35:10 +0300 |
commit | 7670e3c12ec4d0c08db6b9ac82ebd5279b5f9da2 (patch) | |
tree | 64ae270177b1e1df3c489a13f42e3be3edcf4f9d /Lib/sqlite3/test/transactions.py | |
parent | 41ae559108a9249bfbc2af2b06e38dde310a6af6 (diff) | |
parent | 1003b34c71d53ccb88ae2768aaba503ae6b5bc16 (diff) | |
download | cpython-7670e3c12ec4d0c08db6b9ac82ebd5279b5f9da2.tar.gz cpython-7670e3c12ec4d0c08db6b9ac82ebd5279b5f9da2.zip |
Merge from 3.5
Diffstat (limited to 'Lib/sqlite3/test/transactions.py')
-rw-r--r-- | Lib/sqlite3/test/transactions.py | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py index feb4fa16969..eae26c4f960 100644 --- a/Lib/sqlite3/test/transactions.py +++ b/Lib/sqlite3/test/transactions.py @@ -118,13 +118,8 @@ class TransactionTests(unittest.TestCase): return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") - try: + with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") def CheckLocking(self): """ @@ -137,13 +132,8 @@ class TransactionTests(unittest.TestCase): return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") - try: + with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") # NO self.con2.rollback() HERE!!! self.con1.commit() @@ -159,13 +149,8 @@ class TransactionTests(unittest.TestCase): cur.execute("select 1 union select 2 union select 3") con.rollback() - try: + with self.assertRaises(sqlite.InterfaceError): cur.fetchall() - self.fail("InterfaceError should have been raised") - except sqlite.InterfaceError as e: - pass - except: - self.fail("InterfaceError should have been raised") class SpecialCommandTests(unittest.TestCase): def setUp(self): |