mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-45668: Fix PGO tests without test extensions (GH-29315)
This commit is contained in:
parent
762a4dc936
commit
e73283a20f
13 changed files with 60 additions and 28 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue