Apply upstream fix for bpo-39652

This commit is contained in:
Charles Leifer 2020-05-21 10:08:21 -05:00
parent 2d4a1c3df2
commit b811276962
4 changed files with 26 additions and 11 deletions

View file

@ -68,7 +68,7 @@ class RegressionTests(unittest.TestCase):
def CheckColumnNameWithSpaces(self):
cur = self.con.cursor()
cur.execute('select 1 as "foo bar [datetime]"')
self.assertEqual(cur.description[0][0], "foo bar")
self.assertEqual(cur.description[0][0], "foo bar [datetime]")
cur.execute('select 1 as "foo baz"')
self.assertEqual(cur.description[0][0], "foo baz")

View file

@ -275,13 +275,13 @@ class ColNamesTests(unittest.TestCase):
def CheckColName(self):
self.cur.execute("insert into test(x) values (?)", ("xxx",))
self.cur.execute('select x as "x [bar]" from test')
self.cur.execute('select x as "x y [bar]" from test')
val = self.cur.fetchone()[0]
self.assertEqual(val, "<xxx>")
# Check if the stripping of colnames works. Everything after the first
# whitespace should be stripped.
self.assertEqual(self.cur.description[0][0], "x")
self.assertEqual(self.cur.description[0][0], "x y")
def CheckCaseInConverterName(self):
self.cur.execute("select 'other' as \"x [b1b1]\"")

View file

@ -286,7 +286,7 @@ class FunctionTests(unittest.TestCase):
def CheckFuncDeterministic(self):
mock = unittest.mock.Mock(return_value=None)
self.con.create_function("deterministic", 0, mock, True)
self.con.execute("select deterministic() = deterministic()")
self.con.execute("select 1 where deterministic() AND deterministic()")
self.assertEqual(mock.call_count, 1)
@unittest.skipIf(sqlite.sqlite_version_info >= (3, 8, 3), "SQLite < 3.8.3 needed")