aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-03-21 07:32:25 -0700
committerGitHub <noreply@github.com>2020-03-21 07:32:25 -0700
commit687f5921a46cf95c2a648d8031f9e99cdcc3e6b7 (patch)
tree3c1336581057da00284ddee7d8d5863a7ec4e287 /Lib/sqlite3
parent[3.8] bpo-27807: Skip test_site.test_startup_imports() if pth file (GH-19060)... (diff)
downloadcpython-687f5921a46cf95c2a648d8031f9e99cdcc3e6b7.tar.gz
cpython-687f5921a46cf95c2a648d8031f9e99cdcc3e6b7.tar.bz2
cpython-687f5921a46cf95c2a648d8031f9e99cdcc3e6b7.zip
bpo-39652: Truncate the column name after '[' only if PARSE_COLNAMES is set. (GH-18942)
(cherry picked from commit b146568dfcbcd7409c724f8917e4f77433dd56e4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/sqlite3')
-rw-r--r--Lib/sqlite3/test/regression.py2
-rw-r--r--Lib/sqlite3/test/types.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py
index dd5aec50d18..ce97655c66b 100644
--- a/Lib/sqlite3/test/regression.py
+++ b/Lib/sqlite3/test/regression.py
@@ -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")
diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py
index 19ecd07500f..d26a9cb93f0 100644
--- a/Lib/sqlite3/test/types.py
+++ b/Lib/sqlite3/test/types.py
@@ -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")
+ # '[' (and the preceeding space) should be stripped.
+ self.assertEqual(self.cur.description[0][0], "x y")
def CheckCaseInConverterName(self):
self.cur.execute("select 'other' as \"x [b1b1]\"")