Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_complex.py @ 63416:897fd51051bb
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:41:49 +0000 |
| parents | 2bc54da4b82c |
| children | 9fe76c26ea9f |
line wrap: on
line diff
--- a/Lib/test/test_complex.py Sun Aug 01 09:17:53 2010 +0000 +++ b/Lib/test/test_complex.py Sun Aug 01 10:41:49 2010 +0000 @@ -506,6 +506,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')
