diff options
author | Eric Smith <eric@trueblade.com> | 2010-11-25 16:08:06 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2010-11-25 16:08:06 (GMT) |
commit | 984bb58000df9cdba438c7ecb0bae5ad67878696 (patch) | |
tree | 87077ab2bbe949b5241ed9db5f2073572094ffde /Lib/test/test_float.py | |
parent | c1d98d685032dd831ced32463b3f88cce6af4067 (diff) | |
download | cpython-984bb58000df9cdba438c7ecb0bae5ad67878696.zip cpython-984bb58000df9cdba438c7ecb0bae5ad67878696.tar.gz cpython-984bb58000df9cdba438c7ecb0bae5ad67878696.tar.bz2 |
Issue #7094: Add alternate ('#') flag to __format__ methods for float, complex and Decimal. Allows greater control over when decimal points appear. Added to make transitioning from %-formatting easier. '#g' still has a problem with Decimal which I'll fix soon.
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r-- | Lib/test/test_float.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index e0479db..0072133 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -706,11 +706,8 @@ class RoundTestCase(unittest.TestCase): def test(fmt, value, expected): # Test with both % and format(). self.assertEqual(fmt % value, expected, fmt) - if not '#' in fmt: - # Until issue 7094 is implemented, format() for floats doesn't - # support '#' formatting - fmt = fmt[1:] # strip off the % - self.assertEqual(format(value, fmt), expected, fmt) + fmt = fmt[1:] # strip off the % + self.assertEqual(format(value, fmt), expected, fmt) for fmt in ['%e', '%f', '%g', '%.0e', '%.6f', '%.20g', '%#e', '%#f', '%#g', '%#.20e', '%#.15f', '%#.3g']: |