summaryrefslogtreecommitdiff
path: root/tests/test_extras_dictcursor.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-05-13 23:51:21 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-05-18 12:15:50 +0100
commitbc84b6233eaa1e7a6302b51f8ab8950534ff1813 (patch)
tree076031f0e5fec49835b25375963c6e042a8b1315 /tests/test_extras_dictcursor.py
parent548e28135023252ea79830e52521e2a8c1c0bd37 (diff)
downloadpsycopg2-bc84b6233eaa1e7a6302b51f8ab8950534ff1813.tar.gz
Allow non-ascii chars in namedtuple fields
They can be valid chars in Python 3. Or maybe not? In which case Python will throw an exception, but that's fine. Fix regression introduced fixing #211
Diffstat (limited to 'tests/test_extras_dictcursor.py')
-rwxr-xr-xtests/test_extras_dictcursor.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/test_extras_dictcursor.py b/tests/test_extras_dictcursor.py
index 99bdeee..2a46fba 100755
--- a/tests/test_extras_dictcursor.py
+++ b/tests/test_extras_dictcursor.py
@@ -19,7 +19,7 @@ from datetime import timedelta
import psycopg2
import psycopg2.extras
import unittest
-from .testutils import ConnectingTestCase, skip_before_postgres
+from .testutils import ConnectingTestCase, skip_before_postgres, skip_before_python
class ExtrasDictCursorTests(ConnectingTestCase):
@@ -357,6 +357,13 @@ class NamedTupleCursorTest(ConnectingTestCase):
self.assertEqual(rv.f_column_, 2)
self.assertEqual(rv.f3, 3)
+ @skip_before_python(3)
+ def test_nonascii_name(self):
+ curs = self.conn.cursor()
+ curs.execute('select 1 as \xe5h\xe9')
+ rv = curs.fetchone()
+ self.assertEqual(getattr(rv, '\xe5h\xe9'), 1)
+
def test_minimal_generation(self):
# Instrument the class to verify it gets called the minimum number of times.
from psycopg2.extras import NamedTupleCursor