diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-04-29 20:41:00 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-04-29 20:41:00 (GMT) |
commit | 92fcc9c9919b41a611b1dc084ad8f414f1e4278d (patch) | |
tree | b13d3ca4bad7c446d6b26c8efaffefca3e51eedd /Lib | |
parent | 867475c970417edc25f800c4b2aeb8a3108b62db (diff) | |
download | cpython-92fcc9c9919b41a611b1dc084ad8f414f1e4278d.zip cpython-92fcc9c9919b41a611b1dc084ad8f414f1e4278d.tar.gz cpython-92fcc9c9919b41a611b1dc084ad8f414f1e4278d.tar.bz2 |
Issue #5864: format(1234.5, '.4') gives misleading result
(Backport of r72109 from py3k.)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_float.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 0b1ae96..da9c439 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -253,6 +253,11 @@ class IEEEFormatTestCase(unittest.TestCase): self.assertEquals(math.atan2(float('-1e-1000'), -1), math.atan2(-0.0, -1)) + def test_issue5864(self): + self.assertEquals(format(123.456, '.4'), '123.5') + self.assertEquals(format(1234.56, '.4'), '1.235e+03') + self.assertEquals(format(12345.6, '.4'), '1.235e+04') + class ReprTestCase(unittest.TestCase): def test_repr(self): floats_file = open(os.path.join(os.path.split(__file__)[0], |