bpo-45668: Fix PGO tests without test extensions (GH-29315)

This commit is contained in:
Christian Heimes 2021-11-01 12:14:53 +02:00 committed by GitHub
parent 762a4dc936
commit e73283a20f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 60 additions and 28 deletions

View file

@ -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