Issue #20532: Tests which use _testcapi now are marked as CPython only.

This commit is contained in:
Serhiy Storchaka 2014-02-07 10:10:55 +02:00
commit f28ba369dd
29 changed files with 284 additions and 118 deletions

View file

@ -332,19 +332,28 @@ 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))