summaryrefslogtreecommitdiff
path: root/tests/test_connection.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_connection.py')
-rwxr-xr-xtests/test_connection.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_connection.py b/tests/test_connection.py
index a82bd49..4625e7e 100755
--- a/tests/test_connection.py
+++ b/tests/test_connection.py
@@ -246,6 +246,13 @@ class ConnectionTests(ConnectingTestCase):
else:
del os.environ['PGCLIENTENCODING']
+ def test_connect_no_string(self):
+ class MyString(str):
+ pass
+
+ conn = psycopg2.connect(MyString(dsn))
+ conn.close()
+
def test_weakref(self):
from weakref import ref
import gc
@@ -400,6 +407,13 @@ class ParseDsnTestCase(ConnectingTestCase):
self.assertRaises(TypeError, ext.parse_dsn, None)
self.assertRaises(TypeError, ext.parse_dsn, 42)
+ def test_str_subclass(self):
+ class MyString(str):
+ pass
+
+ res = ext.parse_dsn(MyString("dbname=test"))
+ self.assertEqual(res, {'dbname': 'test'})
+
class MakeDsnTestCase(ConnectingTestCase):
def test_empty_arguments(self):