summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_format.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-02-07 08:10:55 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-02-07 08:10:55 (GMT)
commitf28ba369dd068a76ff5b7efac58fdcb5c3eaf4dd (patch)
tree541cb209a2be79d6022ce5d47216755e9e9310a4 /Lib/test/test_format.py
parent622be340fdf4110c77e1f86bd13a01fc30c2bb65 (diff)
parent5cfc79deaeabf4af3c767665098a37da9f375eda (diff)
downloadcpython-f28ba369dd068a76ff5b7efac58fdcb5c3eaf4dd.zip
cpython-f28ba369dd068a76ff5b7efac58fdcb5c3eaf4dd.tar.gz
cpython-f28ba369dd068a76ff5b7efac58fdcb5c3eaf4dd.tar.bz2
Issue #20532: Tests which use _testcapi now are marked as CPython only.
Diffstat (limited to 'Lib/test/test_format.py')
-rw-r--r--Lib/test/test_format.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index 015d68e..fc71e48 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -332,20 +332,29 @@ class FormatTest(unittest.TestCase):
self.assertIs(text % (), text)
self.assertIs(text.format(), text)
- @support.cpython_only
def test_precision(self):
- from _testcapi import INT_MAX
-
f = 1.2
self.assertEqual(format(f, ".0f"), "1")
self.assertEqual(format(f, ".3f"), "1.200")
with self.assertRaises(ValueError) as cm:
- format(f, ".%sf" % (INT_MAX + 1))
+ format(f, ".%sf" % (sys.maxsize + 1))
c = complex(f)
self.assertEqual(format(c, ".0f"), "1+0j")
self.assertEqual(format(c, ".3f"), "1.200+0.000j")
with self.assertRaises(ValueError) as cm:
+ format(c, ".%sf" % (sys.maxsize + 1))
+
+ @support.cpython_only
+ def test_precision_c_limits(self):
+ from _testcapi import INT_MAX
+
+ f = 1.2
+ with self.assertRaises(ValueError) as cm:
+ format(f, ".%sf" % (INT_MAX + 1))
+
+ c = complex(f)
+ with self.assertRaises(ValueError) as cm:
format(c, ".%sf" % (INT_MAX + 1))