summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-09-06 21:03:22 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-09-06 21:03:22 (GMT)
commit7e958d1ceb0b92fa7bace7040ce042474d3ea510 (patch)
tree0b7dcbb7ef25848b87508066dff09d73cb9a093b /Lib/test
parent5651eaa720e28fb95b78524524ee75bda2d0ae59 (diff)
downloadcpython-7e958d1ceb0b92fa7bace7040ce042474d3ea510.zip
cpython-7e958d1ceb0b92fa7bace7040ce042474d3ea510.tar.gz
cpython-7e958d1ceb0b92fa7bace7040ce042474d3ea510.tar.bz2
I modified the tests a bit to account for unicode string
Merged revisions 66270 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r66270 | amaury.forgeotdarc | 2008-09-06 22:53:51 +0200 (sam., 06 sept. 2008) | 3 lines #3796: A test class was not run in test_float. Reviewed by Benjamin. ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_float.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index cad745b..98dce32 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -5,6 +5,7 @@ from test import support
import math
from math import isinf, isnan, copysign, ldexp
import operator
+import random, fractions
INF = float("inf")
NAN = float("nan")
@@ -15,6 +16,7 @@ class GeneralFloatCases(unittest.TestCase):
self.assertEqual(float(3.14), 3.14)
self.assertEqual(float(314), 314.0)
self.assertEqual(float(" 3.14 "), 3.14)
+ self.assertEqual(float(b" 3.14 "), 3.14)
self.assertRaises(ValueError, float, " 0x3.1 ")
self.assertRaises(ValueError, float, " -0x3.p-1 ")
self.assertRaises(ValueError, float, " +0x3.p-1 ")
@@ -22,10 +24,7 @@ class GeneralFloatCases(unittest.TestCase):
self.assertRaises(ValueError, float, "+-3.14")
self.assertRaises(ValueError, float, "-+3.14")
self.assertRaises(ValueError, float, "--3.14")
- self.assertEqual(float(unicode(" 3.14 ")), 3.14)
- self.assertEqual(float(unicode(" \u0663.\u0661\u0664 ",'raw-unicode-escape')), 3.14)
- # Implementation limitation in PyFloat_FromString()
- self.assertRaises(ValueError, float, unicode("1"*10000))
+ self.assertEqual(float(b" \u0663.\u0661\u0664 ".decode('raw-unicode-escape')), 3.14)
@support.run_with_locale('LC_NUMERIC', 'fr_FR', 'de_DE')
def test_float_with_comma(self):
@@ -766,6 +765,7 @@ class HexFloatTestCase(unittest.TestCase):
def test_main():
support.run_unittest(
+ GeneralFloatCases,
FormatFunctionsTestCase,
UnknownFormatTestCase,
IEEEFormatTestCase,