[Python-checkins] cpython (merge 3.5 -> default): Merge from 3.5
berker.peksag
python-checkins at python.org
Mon Jun 13 17:42:55 EDT 2016
https://hg.python.org/cpython/rev/26b6a2fad37c
changeset: 101980:26b6a2fad37c
parent: 101978:bb67de625cb2
parent: 101979:e5822da9a609
user: Berker Peksag <berker.peksag at gmail.com>
date: Tue Jun 14 00:43:14 2016 +0300
summary:
Merge from 3.5
files:
Lib/sqlite3/test/dbapi.py | 3 +--
Lib/sqlite3/test/hooks.py | 4 ++--
Lib/sqlite3/test/regression.py | 12 +++---------
3 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -335,8 +335,7 @@
def CheckTotalChanges(self):
self.cu.execute("insert into test(name) values ('foo')")
self.cu.execute("insert into test(name) values ('foo')")
- if self.cx.total_changes < 2:
- self.fail("total changes reported wrong value")
+ self.assertLess(2, self.cx.total_changes, msg='total changes reported wrong value')
# Checks for executemany:
# Sequences are required by the DB-API, iterators
diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py
--- a/Lib/sqlite3/test/hooks.py
+++ b/Lib/sqlite3/test/hooks.py
@@ -61,8 +61,8 @@
) order by x collate mycoll
"""
result = con.execute(sql).fetchall()
- if result[0][0] != "c" or result[1][0] != "b" or result[2][0] != "a":
- self.fail("the expected order was not returned")
+ self.assertEqual(result, [('c',), ('b',), ('a',)],
+ msg='the expected order was not returned')
con.create_collation("mycoll", None)
with self.assertRaises(sqlite.OperationalError) as cm:
diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py
--- a/Lib/sqlite3/test/regression.py
+++ b/Lib/sqlite3/test/regression.py
@@ -134,17 +134,11 @@
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):
"""
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list