]> granicus.if.org Git - python/commitdiff
Issue #18659: fix test_format test that wasn't being executed. Thanks Vajrasky Kok...
authorMark Dickinson <dickinsm@gmail.com>
Sun, 13 Oct 2013 10:04:36 +0000 (11:04 +0100)
committerMark Dickinson <dickinsm@gmail.com>
Sun, 13 Oct 2013 10:04:36 +0000 (11:04 +0100)
Lib/test/test_format.py

index 9f7630c58e3fefc4742b965b6fcc1e4c351b0444..e48791da6c4a3deb32b182095f7e7d3854b072e9 100644 (file)
@@ -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")