mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Added test to show failed adaptation of None in records.
This commit is contained in:
parent
69c66a3a3f
commit
b5a8facb9c
|
@ -349,6 +349,22 @@ class HstoreTestCase(unittest.TestCase):
|
|||
ok(dict(zip(ab, ab)))
|
||||
|
||||
|
||||
class AdaptTypeTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.conn = psycopg2.connect(tests.dsn)
|
||||
|
||||
def tearDown(self):
|
||||
self.conn.close()
|
||||
|
||||
def test_none_in_record(self):
|
||||
curs = self.conn.cursor()
|
||||
s = curs.mogrify("SELECT %s;", [(42, None)])
|
||||
self.assertEqual("SELECT (42, NULL);", s)
|
||||
curs.execute("SELECT %s;", [(42, None)])
|
||||
d = curs.fetchone()[0]
|
||||
self.assertEqual("(42,)", d)
|
||||
|
||||
|
||||
def test_suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user