mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Issue #5864: Fix problem with empty code formatting for floats,
where a bogus trailing zero could be added.
This commit is contained in:
parent
b507d2e07d
commit
d3ca557150
4 changed files with 124 additions and 78 deletions
|
|
@ -328,6 +328,11 @@ class FormatTestCase(unittest.TestCase):
|
|||
self.assertEqual(fmt % float(arg), rhs)
|
||||
self.assertEqual(fmt % -float(arg), '-' + rhs)
|
||||
|
||||
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],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue