diff options
author | Christian Heimes <christian@python.org> | 2021-11-01 10:14:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-01 10:14:53 (GMT) |
commit | e73283a20fb05b70da2990decefac0e011faec17 (patch) | |
tree | a490f99e1eab3e779b5828b8f51994e91b4aa2b6 /Lib/test/string_tests.py | |
parent | 762a4dc9361f9563e158e373ba8d767b4449f23d (diff) | |
download | cpython-e73283a20fb05b70da2990decefac0e011faec17.zip cpython-e73283a20fb05b70da2990decefac0e011faec17.tar.gz cpython-e73283a20fb05b70da2990decefac0e011faec17.tar.bz2 |
bpo-45668: Fix PGO tests without test extensions (GH-29315)
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r-- | Lib/test/string_tests.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index 089701c..0d4c7ec 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -4,6 +4,7 @@ Common tests shared by test_unicode, test_userstring and test_bytes. import unittest, string, sys, struct from test import support +from test.support import import_helper from collections import UserList import random @@ -1328,17 +1329,17 @@ class MixinStrUnicodeUserStringTest: @support.cpython_only def test_formatting_c_limits(self): - from _testcapi import PY_SSIZE_T_MAX, INT_MAX, UINT_MAX - SIZE_MAX = (1 << (PY_SSIZE_T_MAX.bit_length() + 1)) - 1 + _testcapi = import_helper.import_module('_testcapi') + SIZE_MAX = (1 << (_testcapi.PY_SSIZE_T_MAX.bit_length() + 1)) - 1 self.checkraises(OverflowError, '%*s', '__mod__', - (PY_SSIZE_T_MAX + 1, '')) + (_testcapi.PY_SSIZE_T_MAX + 1, '')) self.checkraises(OverflowError, '%.*f', '__mod__', - (INT_MAX + 1, 1. / 7)) + (_testcapi.INT_MAX + 1, 1. / 7)) # Issue 15989 self.checkraises(OverflowError, '%*s', '__mod__', (SIZE_MAX + 1, '')) self.checkraises(OverflowError, '%.*f', '__mod__', - (UINT_MAX + 1, 1. / 7)) + (_testcapi.UINT_MAX + 1, 1. / 7)) def test_floatformatting(self): # float formatting |