mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Issue #20532: Tests which use _testcapi now are marked as CPython only.
This commit is contained in:
parent
fe4ef392d5
commit
5cfc79deae
25 changed files with 239 additions and 106 deletions
|
|
@ -1108,8 +1108,13 @@ class UnicodeTest(string_tests.CommonTest,
|
|||
self.assertEqual('%.1s' % "a\xe9\u20ac", 'a')
|
||||
self.assertEqual('%.2s' % "a\xe9\u20ac", 'a\xe9')
|
||||
|
||||
@support.cpython_only
|
||||
def test_formatting_huge_precision(self):
|
||||
format_string = "%.{}f".format(sys.maxsize + 1)
|
||||
with self.assertRaises(ValueError):
|
||||
result = format_string % 2.34
|
||||
|
||||
@support.cpython_only
|
||||
def test_formatting_huge_precision_c_limits(self):
|
||||
from _testcapi import INT_MAX
|
||||
format_string = "%.{}f".format(INT_MAX + 1)
|
||||
with self.assertRaises(ValueError):
|
||||
|
|
@ -2090,6 +2095,7 @@ class UnicodeTest(string_tests.CommonTest,
|
|||
self.assertEqual(PyUnicode_FromFormat(b'%.%s', b'abc'), '%.%s')
|
||||
|
||||
# Test PyUnicode_AsWideChar()
|
||||
@support.cpython_only
|
||||
def test_aswidechar(self):
|
||||
from _testcapi import unicode_aswidechar
|
||||
support.import_module('ctypes')
|
||||
|
|
@ -2127,6 +2133,7 @@ class UnicodeTest(string_tests.CommonTest,
|
|||
self.assertEqual(wchar, nonbmp + '\0')
|
||||
|
||||
# Test PyUnicode_AsWideCharString()
|
||||
@support.cpython_only
|
||||
def test_aswidecharstring(self):
|
||||
from _testcapi import unicode_aswidecharstring
|
||||
support.import_module('ctypes')
|
||||
|
|
@ -2161,6 +2168,7 @@ class UnicodeTest(string_tests.CommonTest,
|
|||
s += "4"
|
||||
self.assertEqual(s, "3")
|
||||
|
||||
@support.cpython_only
|
||||
def test_encode_decimal(self):
|
||||
from _testcapi import unicode_encodedecimal
|
||||
self.assertEqual(unicode_encodedecimal('123'),
|
||||
|
|
@ -2176,6 +2184,7 @@ class UnicodeTest(string_tests.CommonTest,
|
|||
"^'decimal' codec can't encode character",
|
||||
unicode_encodedecimal, "123\u20ac", "replace")
|
||||
|
||||
@support.cpython_only
|
||||
def test_transform_decimal(self):
|
||||
from _testcapi import unicode_transformdecimaltoascii as transform_decimal
|
||||
self.assertEqual(transform_decimal('123'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue