Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f973c6d

Browse files
committed
Make this test work under Windows as well.
1 parent 99e87f9 commit f973c6d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Lib/test/test_fpformat.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ def checkSci(self, n, digits):
3232
if isinstance(n, StringType):
3333
n = repr(n)
3434
expected = "%.*e" % (digits, float(n))
35-
# add the extra 0
36-
expected = expected[:-2]+'0'+expected[-2:]
35+
# add the extra 0 if needed
36+
num, exp = expected.split("e")
37+
if len(exp) < 4:
38+
exp = exp[0] + "0" + exp[1:]
39+
expected = "%se%s" % (num, exp)
3740

3841
self.assertEquals(result, expected)
3942

0 commit comments

Comments
 (0)