summaryrefslogtreecommitdiff
path: root/tests/test_cursor.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-01-10 23:06:31 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-01-11 08:55:31 +0900
commite0226fc46ad21f10ca612b32659bab442d2db871 (patch)
tree58c7d856398b3e750fab62d9bc8095567ac8df8f /tests/test_cursor.py
parent04f1f06b9f1f627436c1202aaa45434334c8747d (diff)
downloadpsycopg2-mogrify-on-closed-cursor.tar.gz
'cursor.mogrify()' can be called on closed cursorsmogrify-on-closed-cursor
Fix #579.
Diffstat (limited to 'tests/test_cursor.py')
-rwxr-xr-xtests/test_cursor.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_cursor.py b/tests/test_cursor.py
index ec76918..cc8db0f 100755
--- a/tests/test_cursor.py
+++ b/tests/test_cursor.py
@@ -118,6 +118,12 @@ class CursorTests(ConnectingTestCase):
nref2 = sys.getrefcount(foo)
self.assertEqual(nref1, nref2)
+ def test_modify_closed(self):
+ cur = self.conn.cursor()
+ cur.close()
+ sql = cur.mogrify("select %s", (10,))
+ self.assertEqual(sql, b"select 10")
+
def test_bad_placeholder(self):
cur = self.conn.cursor()
self.assertRaises(psycopg2.ProgrammingError,