summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fpformat.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-07-23 16:30:21 (GMT)
committerFred Drake <fdrake@acm.org>2001-07-23 16:30:21 (GMT)
commitf973c6d5949bfed3e74b8b94c427c43df1e4b95c (patch)
tree2fe65653291f8690948c59b3f666806ec116d1b3 /Lib/test/test_fpformat.py
parent99e87f9e23cef10f694964caa475dd0483f33b57 (diff)
downloadcpython-f973c6d5949bfed3e74b8b94c427c43df1e4b95c.zip
cpython-f973c6d5949bfed3e74b8b94c427c43df1e4b95c.tar.gz
cpython-f973c6d5949bfed3e74b8b94c427c43df1e4b95c.tar.bz2
Make this test work under Windows as well.
Diffstat (limited to 'Lib/test/test_fpformat.py')
-rw-r--r--Lib/test/test_fpformat.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_fpformat.py b/Lib/test/test_fpformat.py
index 532b3f7..9d20dc9 100644
--- a/Lib/test/test_fpformat.py
+++ b/Lib/test/test_fpformat.py
@@ -32,8 +32,11 @@ class FpformatTest(unittest.TestCase):
if isinstance(n, StringType):
n = repr(n)
expected = "%.*e" % (digits, float(n))
- # add the extra 0
- expected = expected[:-2]+'0'+expected[-2:]
+ # add the extra 0 if needed
+ num, exp = expected.split("e")
+ if len(exp) < 4:
+ exp = exp[0] + "0" + exp[1:]
+ expected = "%se%s" % (num, exp)
self.assertEquals(result, expected)