diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-08-01 10:45:15 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-08-01 10:45:15 (GMT) |
commit | aad57bd1bbaea92a5619a8d79d3d2ed90d32a35f (patch) | |
tree | 9e6284e69531d8070b5ed31fe4d659daf4b5262a /Lib/test | |
parent | 1f05e2e9baa66b3c6241c2450481eee0756381ca (diff) | |
download | cpython-aad57bd1bbaea92a5619a8d79d3d2ed90d32a35f.zip cpython-aad57bd1bbaea92a5619a8d79d3d2ed90d32a35f.tar.gz cpython-aad57bd1bbaea92a5619a8d79d3d2ed90d32a35f.tar.bz2 |
Merged revisions 83400 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r83400 | mark.dickinson | 2010-08-01 11:41:49 +0100 (Sun, 01 Aug 2010) | 7 lines
Issue #9416: Fix some issues with complex formatting where the
output with no type specifier failed to match the str output:
- format(complex(-0.0, 2.0), '-') omitted the real part from the output,
- format(complex(0.0, 2.0), '-') included a sign and parentheses.
........
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_complex.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py index 69e2715..a459f84 100644 --- a/Lib/test/test_complex.py +++ b/Lib/test/test_complex.py @@ -558,6 +558,16 @@ class ComplexTest(unittest.TestCase): self.assertEqual(format(z, '-'), str(z)) self.assertEqual(format(z, '<'), str(z)) self.assertEqual(format(z, '10'), str(z)) + z = complex(0.0, 3.0) + self.assertEqual(format(z, ''), str(z)) + self.assertEqual(format(z, '-'), str(z)) + self.assertEqual(format(z, '<'), str(z)) + self.assertEqual(format(z, '2'), str(z)) + z = complex(-0.0, 2.0) + self.assertEqual(format(z, ''), str(z)) + self.assertEqual(format(z, '-'), str(z)) + self.assertEqual(format(z, '<'), str(z)) + self.assertEqual(format(z, '3'), str(z)) self.assertEqual(format(1+3j, 'g'), '1+3j') self.assertEqual(format(3j, 'g'), '0+3j') |