From 985425fb389c87610c3a3d7d0771250e49a146c8 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 6 Nov 2010 02:24:28 +0000 Subject: [PATCH] Added test to verify the ticket #7 is fixed. --- tests/test_cursor.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_cursor.py b/tests/test_cursor.py index a2c3b247..ada2d604 100644 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -53,6 +53,19 @@ class CursorTests(unittest.TestCase): self.assertEqual("SELECT '%s';" % snowman.encode('utf8'), cur.mogrify(u"SELECT %s;", (snowman,)).replace("E'", "'")) + def test_mogrify_decimal_explodes(self): + # issue #7: explodes on windows with python 2.5 and psycopg 2.2.2 + try: + from decimal import Decimal + except: + return + + conn = self.connect() + cur = conn.cursor() + self.assertEqual('SELECT 10.3;', + cur.mogrify("SELECT %s;", (Decimal("10.3"),))) + + def test_suite(): return unittest.TestLoader().loadTestsFromName(__name__)