From 2804f9a6a98fb0f135165ef726b1d3f7c827f31c Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Fri, 27 May 2005 08:43:33 +0000 Subject: [PATCH] Regression tests fixes. --- ChangeLog | 4 ++++ tests/types_basic.py | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 541b866f..2002420a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-5-27 Federico Di Gregorio, + + * tests/types_basic.py: fixed float and binary tests. + 2005-05-26 Federico Di Gregorio * Release 2.0b3. diff --git a/tests/types_basic.py b/tests/types_basic.py index fe8478b8..64f2c878 100644 --- a/tests/types_basic.py +++ b/tests/types_basic.py @@ -43,13 +43,14 @@ class TypesBasicTests(TestCase): s = self.execute("SELECT %s AS foo", (1971L,)) self.failUnless(s == 1971L, "wrong integer quoting: " + str(s)) s = self.execute("SELECT %s AS foo", (19.10,)) - self.failUnless(s == 19.10, "wrong float quoting: " + str(s)) + self.failUnless(abs(s - 19.10) < 0.001, + "wrong float quoting: " + str(s)) def testBinary(self): s = ''.join([chr(x) for x in range(256)]) b = psycopg.Binary(s) - self.failUnless(self.execute("SELECT %s::bytea AS foo", (b,)) == s, - "wrong binary quoting") + r = str(self.execute("SELECT %s::bytea AS foo", (b,))) + self.failUnless(r == s, "wrong binary quoting") class TypesBasicSuite(TestSuite): """Build a suite of all tests."""