2222# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
2323# License for more details.
2424
25- try :
26- import decimal
27- except :
28- pass
25+ import decimal
2926
3027import sys
3128from functools import wraps
@@ -66,10 +63,6 @@ def testNumber(self):
6663 self .failUnless (s == 1971 , "wrong integer quoting: " + str (s ))
6764 s = self .execute ("SELECT %s AS foo" , (1971L ,))
6865 self .failUnless (s == 1971L , "wrong integer quoting: " + str (s ))
69- if sys .version_info [0 :2 ] < (2 , 4 ):
70- s = self .execute ("SELECT %s AS foo" , (19.10 ,))
71- self .failUnless (abs (s - 19.10 ) < 0.001 ,
72- "wrong float quoting: " + str (s ))
7366
7467 def testBoolean (self ):
7568 x = self .execute ("SELECT %s as foo" , (False ,))
@@ -78,21 +71,18 @@ def testBoolean(self):
7871 self .assert_ (x is True )
7972
8073 def testDecimal (self ):
81- if sys .version_info [0 :2 ] >= (2 , 4 ):
82- s = self .execute ("SELECT %s AS foo" , (decimal .Decimal ("19.10" ),))
83- self .failUnless (s - decimal .Decimal ("19.10" ) == 0 ,
84- "wrong decimal quoting: " + str (s ))
85- s = self .execute ("SELECT %s AS foo" , (decimal .Decimal ("NaN" ),))
86- self .failUnless (str (s ) == "NaN" , "wrong decimal quoting: " + str (s ))
87- self .failUnless (type (s ) == decimal .Decimal , "wrong decimal conversion: " + repr (s ))
88- s = self .execute ("SELECT %s AS foo" , (decimal .Decimal ("infinity" ),))
89- self .failUnless (str (s ) == "NaN" , "wrong decimal quoting: " + str (s ))
90- self .failUnless (type (s ) == decimal .Decimal , "wrong decimal conversion: " + repr (s ))
91- s = self .execute ("SELECT %s AS foo" , (decimal .Decimal ("-infinity" ),))
92- self .failUnless (str (s ) == "NaN" , "wrong decimal quoting: " + str (s ))
93- self .failUnless (type (s ) == decimal .Decimal , "wrong decimal conversion: " + repr (s ))
94- else :
95- return self .skipTest ("decimal not available" )
74+ s = self .execute ("SELECT %s AS foo" , (decimal .Decimal ("19.10" ),))
75+ self .failUnless (s - decimal .Decimal ("19.10" ) == 0 ,
76+ "wrong decimal quoting: " + str (s ))
77+ s = self .execute ("SELECT %s AS foo" , (decimal .Decimal ("NaN" ),))
78+ self .failUnless (str (s ) == "NaN" , "wrong decimal quoting: " + str (s ))
79+ self .failUnless (type (s ) == decimal .Decimal , "wrong decimal conversion: " + repr (s ))
80+ s = self .execute ("SELECT %s AS foo" , (decimal .Decimal ("infinity" ),))
81+ self .failUnless (str (s ) == "NaN" , "wrong decimal quoting: " + str (s ))
82+ self .failUnless (type (s ) == decimal .Decimal , "wrong decimal conversion: " + repr (s ))
83+ s = self .execute ("SELECT %s AS foo" , (decimal .Decimal ("-infinity" ),))
84+ self .failUnless (str (s ) == "NaN" , "wrong decimal quoting: " + str (s ))
85+ self .failUnless (type (s ) == decimal .Decimal , "wrong decimal conversion: " + repr (s ))
9686
9787 def testFloatNan (self ):
9888 try :
0 commit comments