Regression tests fixes.

This commit is contained in:
Federico Di Gregorio 2005-05-27 08:43:33 +00:00
parent 75d14dfb6e
commit 2804f9a6a9
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2005-5-27 Federico Di Gregorio, <fog@lana.initd.org>
* tests/types_basic.py: fixed float and binary tests.
2005-05-26 Federico Di Gregorio <fog@debian.org> 2005-05-26 Federico Di Gregorio <fog@debian.org>
* Release 2.0b3. * Release 2.0b3.

View File

@ -43,13 +43,14 @@ class TypesBasicTests(TestCase):
s = self.execute("SELECT %s AS foo", (1971L,)) s = self.execute("SELECT %s AS foo", (1971L,))
self.failUnless(s == 1971L, "wrong integer quoting: " + str(s)) self.failUnless(s == 1971L, "wrong integer quoting: " + str(s))
s = self.execute("SELECT %s AS foo", (19.10,)) 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): def testBinary(self):
s = ''.join([chr(x) for x in range(256)]) s = ''.join([chr(x) for x in range(256)])
b = psycopg.Binary(s) b = psycopg.Binary(s)
self.failUnless(self.execute("SELECT %s::bytea AS foo", (b,)) == s, r = str(self.execute("SELECT %s::bytea AS foo", (b,)))
"wrong binary quoting") self.failUnless(r == s, "wrong binary quoting")
class TypesBasicSuite(TestSuite): class TypesBasicSuite(TestSuite):
"""Build a suite of all tests.""" """Build a suite of all tests."""