diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2013-10-13 10:04:36 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2013-10-13 10:04:36 (GMT) |
commit | ef8627b3f08b23bf841bf490fcda70cff12d770c (patch) | |
tree | cc40855095c41d45030297f2bd4df3e39918123d | |
parent | 31f6f4dd03896aeba7f747119ee06187427b46b3 (diff) | |
download | cpython-ef8627b3f08b23bf841bf490fcda70cff12d770c.zip cpython-ef8627b3f08b23bf841bf490fcda70cff12d770c.tar.gz cpython-ef8627b3f08b23bf841bf490fcda70cff12d770c.tar.bz2 |
Issue #18659: fix test_format test that wasn't being executed. Thanks Vajrasky Kok for the patch.
-rw-r--r-- | Lib/test/test_format.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py index 9f7630c..e48791d 100644 --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -327,12 +327,9 @@ class FormatTest(unittest.TestCase): self.assertIs(text % (), text) self.assertIs(text.format(), text) - -def test_main(): - support.run_unittest(FormatTest) - + @support.cpython_only def test_precision(self): - INT_MAX = 2147483647 + from _testcapi import INT_MAX f = 1.2 self.assertEqual(format(f, ".0f"), "1") @@ -342,10 +339,10 @@ def test_main(): self.assertEqual(str(cm.exception), "precision too big") c = complex(f) - self.assertEqual(format(f, ".0f"), "1") - self.assertEqual(format(f, ".3f"), "1.200") + self.assertEqual(format(c, ".0f"), "1+0j") + self.assertEqual(format(c, ".3f"), "1.200+0.000j") with self.assertRaises(ValueError) as cm: - format(f, ".%sf" % (INT_MAX + 1)) + format(c, ".%sf" % (INT_MAX + 1)) self.assertEqual(str(cm.exception), "precision too big") |