mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-39652: Truncate the column name after '[' only if PARSE_COLNAMES is set. (GH-18942)
This commit is contained in:
parent
684d2b9a07
commit
b146568dfc
5 changed files with 32 additions and 14 deletions
|
@ -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")
|
||||
|
|
|
@ -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]\"")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue