Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_complex.py @ 63417:398fa7b7753a 3.1
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.
........
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Sun, 01 Aug 2010 10:43:42 +0000 |
| parents | e6f1b3d1040a |
| children | 2beb25369289 |
line wrap: on
line diff
--- a/Lib/test/test_complex.py Sun Aug 01 04:14:22 2010 +0000 +++ b/Lib/test/test_complex.py Sun Aug 01 10:43:42 2010 +0000 @@ -480,6 +480,16 @@ 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')
