From 21dfc2c5924dcce2912152b908e5b6c80d7b473e Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 19 Nov 2010 10:44:39 +0000 Subject: [PATCH] Float test skipped where the server doesn't support inf. --- tests/types_basic.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/types_basic.py b/tests/types_basic.py index 8e6f1993..0bdecf74 100755 --- a/tests/types_basic.py +++ b/tests/types_basic.py @@ -81,7 +81,7 @@ class TypesBasicTests(unittest.TestCase): else: return self.skipTest("decimal not available") - def testFloat(self): + def testFloatNan(self): try: float("nan") except ValueError: @@ -90,6 +90,13 @@ class TypesBasicTests(unittest.TestCase): s = self.execute("SELECT %s AS foo", (float("nan"),)) self.failUnless(str(s) == "nan", "wrong float quoting: " + str(s)) self.failUnless(type(s) == float, "wrong float conversion: " + repr(s)) + + def testFloatInf(self): + try: + self.execute("select 'inf'::float") + except psycopg2.DataError: + return self.skipTest("inf::float not available on the server") + s = self.execute("SELECT %s AS foo", (float("inf"),)) self.failUnless(str(s) == "inf", "wrong float quoting: " + str(s)) self.failUnless(type(s) == float, "wrong float conversion: " + repr(s))