mirror of
https://github.com/python/cpython.git
synced 2025-10-08 08:01:55 +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
|
@ -7,6 +7,7 @@ import struct
|
|||
import sys
|
||||
|
||||
from test import support
|
||||
from test.support import import_helper
|
||||
from test.support.script_helper import assert_python_ok
|
||||
|
||||
ISBIGENDIAN = sys.byteorder == "big"
|
||||
|
@ -680,8 +681,8 @@ class StructTest(unittest.TestCase):
|
|||
|
||||
@support.cpython_only
|
||||
def test_issue45034_unsigned(self):
|
||||
from _testcapi import USHRT_MAX
|
||||
error_msg = f'ushort format requires 0 <= number <= {USHRT_MAX}'
|
||||
_testcapi = import_helper.import_module('_testcapi')
|
||||
error_msg = f'ushort format requires 0 <= number <= {_testcapi.USHRT_MAX}'
|
||||
with self.assertRaisesRegex(struct.error, error_msg):
|
||||
struct.pack('H', 70000) # too large
|
||||
with self.assertRaisesRegex(struct.error, error_msg):
|
||||
|
@ -689,8 +690,8 @@ class StructTest(unittest.TestCase):
|
|||
|
||||
@support.cpython_only
|
||||
def test_issue45034_signed(self):
|
||||
from _testcapi import SHRT_MIN, SHRT_MAX
|
||||
error_msg = f'short format requires {SHRT_MIN} <= number <= {SHRT_MAX}'
|
||||
_testcapi = import_helper.import_module('_testcapi')
|
||||
error_msg = f'short format requires {_testcapi.SHRT_MIN} <= number <= {_testcapi.SHRT_MAX}'
|
||||
with self.assertRaisesRegex(struct.error, error_msg):
|
||||
struct.pack('h', 70000) # too large
|
||||
with self.assertRaisesRegex(struct.error, error_msg):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue