Added test to show failed adaptation of None in records.

This commit is contained in:
Daniele Varrazzo 2010-12-31 18:40:28 +01:00
parent 69c66a3a3f
commit b5a8facb9c

View File

@ -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__)