]> granicus.if.org Git - python/commitdiff
Make this test work under Windows as well.
authorFred Drake <fdrake@acm.org>
Mon, 23 Jul 2001 16:30:21 +0000 (16:30 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 23 Jul 2001 16:30:21 +0000 (16:30 +0000)
Lib/test/test_fpformat.py

index 532b3f7acf5e97413feb5794ea11b82d6fef67ab..9d20dc991fc7afce99bef9732dac32f5507679de 100644 (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)