Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_format.py @ 86298:e7eed20f2da7
Issue #18659: fix test_format test that wasn't being executed. Thanks Vajrasky Kok for the patch.
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Sun, 13 Oct 2013 11:04:36 +0100 |
| parents | 9bee1fd64ee6 |
| children | d115dc671f52 |
line wrap: on
line diff
--- a/Lib/test/test_format.py Sun Oct 13 10:49:47 2013 +0200 +++ b/Lib/test/test_format.py Sun Oct 13 11:04:36 2013 +0100 @@ -327,12 +327,9 @@ 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 @@ 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")
