summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_complex.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-08-01 10:43:42 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-08-01 10:43:42 (GMT)
commitfc070313ddc6868b3679ee8d8e59e2e6bfb12406 (patch)
tree35384e656930603ac0562d77eef4bdc52338f984 /Lib/test/test_complex.py
parentea6ff81323a6e68c4ce3287011d7319993c66e57 (diff)
downloadcpython-fc070313ddc6868b3679ee8d8e59e2e6bfb12406.zip
cpython-fc070313ddc6868b3679ee8d8e59e2e6bfb12406.tar.gz
cpython-fc070313ddc6868b3679ee8d8e59e2e6bfb12406.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/test_complex.py')
-rw-r--r--Lib/test/test_complex.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py
index f28bb69..52429ad 100644
--- a/Lib/test/test_complex.py
+++ b/Lib/test/test_complex.py
@@ -480,6 +480,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')