From: Fred Drake Date: Mon, 23 Jul 2001 16:30:21 +0000 (+0000) Subject: Make this test work under Windows as well. X-Git-Tag: v2.2a3~988 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f973c6d5949bfed3e74b8b94c427c43df1e4b95c;p=thirdparty%2FPython%2Fcpython.git Make this test work under Windows as well. --- diff --git a/Lib/test/test_fpformat.py b/Lib/test/test_fpformat.py index 532b3f7acf5e..9d20dc991fc7 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)