diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-06-13 21:42:50 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-06-13 21:42:50 (GMT) |
commit | 48b5c98e6e0139c24298f6ed7962da29d0f9cb89 (patch) | |
tree | 53c7337a6959ea48dfbe1625dfdec222962d625d /Lib/sqlite3/test/regression.py | |
parent | f5b1af6df559f1c29211701f21bd181eab6a5b60 (diff) | |
download | cpython-48b5c98e6e0139c24298f6ed7962da29d0f9cb89.zip cpython-48b5c98e6e0139c24298f6ed7962da29d0f9cb89.tar.gz cpython-48b5c98e6e0139c24298f6ed7962da29d0f9cb89.tar.bz2 |
Replace more boilerplate code with modern unittest features in sqlite3 tests
Diffstat (limited to 'Lib/sqlite3/test/regression.py')
-rw-r--r-- | Lib/sqlite3/test/regression.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py index 85ace84..0cf9002 100644 --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -134,17 +134,11 @@ class RegressionTests(unittest.TestCase): def CheckErrorMsgDecodeError(self): # When porting the module to Python 3.0, the error message about # decoding errors disappeared. This verifies they're back again. - failure = None - try: + with self.assertRaises(sqlite.OperationalError) as cm: self.con.execute("select 'xxx' || ? || 'yyy' colname", (bytes(bytearray([250])),)).fetchone() - failure = "should have raised an OperationalError with detailed description" - except sqlite.OperationalError as e: - msg = e.args[0] - if not msg.startswith("Could not decode to UTF-8 column 'colname' with text 'xxx"): - failure = "OperationalError did not have expected description text" - if failure: - self.fail(failure) + msg = "Could not decode to UTF-8 column 'colname' with text 'xxx" + self.assertIn(msg, str(cm.exception)) def CheckRegisterAdapter(self): """ |