31
31
32
32
from test .support import (
33
33
SHORT_TIMEOUT , check_disallow_instantiation , requires_subprocess ,
34
- is_apple , is_emscripten , is_wasi
34
+ is_apple , is_emscripten , is_wasi , import_helper
35
35
)
36
36
from test .support import gc_collect
37
37
from test .support import threading_helper
38
- from _testcapi import INT_MAX , ULLONG_MAX
39
38
from os import SEEK_SET , SEEK_CUR , SEEK_END
40
39
from test .support .os_helper import TESTFN , TESTFN_UNDECODABLE , unlink , temp_dir , FakePath
41
40
@@ -1200,6 +1199,7 @@ def test_blob_seek_and_tell(self):
1200
1199
self .assertEqual (self .blob .tell (), 40 )
1201
1200
1202
1201
def test_blob_seek_error (self ):
1202
+ testcapi = import_helper .import_module ("_testcapi" )
1203
1203
msg_oor = "offset out of blob range"
1204
1204
msg_orig = "'origin' should be os.SEEK_SET, os.SEEK_CUR, or os.SEEK_END"
1205
1205
msg_of = "seek offset results in overflow"
@@ -1217,9 +1217,9 @@ def test_blob_seek_error(self):
1217
1217
# Force overflow errors
1218
1218
self .blob .seek (1 , SEEK_SET )
1219
1219
with self .assertRaisesRegex (OverflowError , msg_of ):
1220
- self .blob .seek (INT_MAX , SEEK_CUR )
1220
+ self .blob .seek (testcapi . INT_MAX , SEEK_CUR )
1221
1221
with self .assertRaisesRegex (OverflowError , msg_of ):
1222
- self .blob .seek (INT_MAX , SEEK_END )
1222
+ self .blob .seek (testcapi . INT_MAX , SEEK_END )
1223
1223
1224
1224
def test_blob_read (self ):
1225
1225
buf = self .blob .read ()
@@ -1374,13 +1374,14 @@ def test_blob_mapping_invalid_index_type(self):
1374
1374
self .blob ["a" ] = b"b"
1375
1375
1376
1376
def test_blob_get_item_error (self ):
1377
+ testcapi = import_helper .import_module ("_testcapi" )
1377
1378
dataset = [len (self .blob ), 105 , - 105 ]
1378
1379
for idx in dataset :
1379
1380
with self .subTest (idx = idx ):
1380
1381
with self .assertRaisesRegex (IndexError , "index out of range" ):
1381
1382
self .blob [idx ]
1382
1383
with self .assertRaisesRegex (IndexError , "cannot fit 'int'" ):
1383
- self .blob [ULLONG_MAX ]
1384
+ self .blob [testcapi . ULLONG_MAX ]
1384
1385
1385
1386
# Provoke read error
1386
1387
self .cx .execute ("update test set b='aaaa' where rowid=1" )
0 commit comments