Merged revisions 70430 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70430 | mark.dickinson | 2009-03-17 18:01:03 +0000 (Tue, 17 Mar 2009) | 3 lines Fix bug in Decimal __format__ method that swapped left and right alignment. ........
This commit is contained in:
parent
44c5481941
commit
ad41634313
|
@ -5630,9 +5630,9 @@ def _format_align(body, spec_dict):
|
|||
|
||||
align = spec_dict['align']
|
||||
if align == '<':
|
||||
result = padding + sign + body
|
||||
elif align == '>':
|
||||
result = sign + body + padding
|
||||
elif align == '>':
|
||||
result = padding + sign + body
|
||||
elif align == '=':
|
||||
result = sign + padding + body
|
||||
else: #align == '^'
|
||||
|
|
|
@ -693,6 +693,12 @@ class DecimalFormatTest(unittest.TestCase):
|
|||
('.0g', '-sNaN', '-sNaN'),
|
||||
|
||||
('', '1.00', '1.00'),
|
||||
|
||||
# check alignment
|
||||
('<6', '123', '123 '),
|
||||
('>6', '123', ' 123'),
|
||||
('^6', '123', ' 123 '),
|
||||
('=+6', '123', '+ 123'),
|
||||
]
|
||||
for fmt, d, result in test_values:
|
||||
self.assertEqual(format(Decimal(d), fmt), result)
|
||||
|
|
Loading…
Reference in New Issue