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

@ -8,6 +8,7 @@ import sys
import unittest
import weakref
from test import support
from test.support import import_helper
class DictTest(unittest.TestCase):
@ -1541,7 +1542,8 @@ class CAPITest(unittest.TestCase):
# Test _PyDict_GetItem_KnownHash()
@support.cpython_only
def test_getitem_knownhash(self):
from _testcapi import dict_getitem_knownhash
_testcapi = import_helper.import_module('_testcapi')
dict_getitem_knownhash = _testcapi.dict_getitem_knownhash
d = {'x': 1, 'y': 2, 'z': 3}
self.assertEqual(dict_getitem_knownhash(d, 'x', hash('x')), 1)