Make this test work under Windows as well.

This commit is contained in:
Fred Drake 2001-07-23 16:30:21 +00:00
parent 99e87f9e23
commit f973c6d594
1 changed files with 5 additions and 2 deletions

View File

@ -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)