11import unittest
22from test .support import import_helper
33
4- _testcapi = import_helper .import_module ('_testcapi ' )
4+ _testlimitedcapi = import_helper .import_module ('_testlimitedcapi ' )
55from _testcapi import PY_SSIZE_T_MIN , PY_SSIZE_T_MAX
66
77NULL = None
@@ -19,7 +19,7 @@ def __bytes__(self):
1919class CAPITest (unittest .TestCase ):
2020 def test_check (self ):
2121 # Test PyBytes_Check()
22- check = _testcapi .bytes_check
22+ check = _testlimitedcapi .bytes_check
2323 self .assertTrue (check (b'abc' ))
2424 self .assertFalse (check ('abc' ))
2525 self .assertFalse (check (bytearray (b'abc' )))
@@ -33,7 +33,7 @@ def test_check(self):
3333
3434 def test_checkexact (self ):
3535 # Test PyBytes_CheckExact()
36- check = _testcapi .bytes_checkexact
36+ check = _testlimitedcapi .bytes_checkexact
3737 self .assertTrue (check (b'abc' ))
3838 self .assertFalse (check ('abc' ))
3939 self .assertFalse (check (bytearray (b'abc' )))
@@ -47,7 +47,7 @@ def test_checkexact(self):
4747
4848 def test_fromstringandsize (self ):
4949 # Test PyBytes_FromStringAndSize()
50- fromstringandsize = _testcapi .bytes_fromstringandsize
50+ fromstringandsize = _testlimitedcapi .bytes_fromstringandsize
5151
5252 self .assertEqual (fromstringandsize (b'abc' ), b'abc' )
5353 self .assertEqual (fromstringandsize (b'abc' , 2 ), b'ab' )
@@ -65,7 +65,7 @@ def test_fromstringandsize(self):
6565
6666 def test_fromstring (self ):
6767 # Test PyBytes_FromString()
68- fromstring = _testcapi .bytes_fromstring
68+ fromstring = _testlimitedcapi .bytes_fromstring
6969
7070 self .assertEqual (fromstring (b'abc\0 def' ), b'abc' )
7171 self .assertEqual (fromstring (b'' ), b'' )
@@ -74,7 +74,7 @@ def test_fromstring(self):
7474
7575 def test_fromobject (self ):
7676 # Test PyBytes_FromObject()
77- fromobject = _testcapi .bytes_fromobject
77+ fromobject = _testlimitedcapi .bytes_fromobject
7878
7979 self .assertEqual (fromobject (b'abc' ), b'abc' )
8080 self .assertEqual (fromobject (bytearray (b'abc' )), b'abc' )
@@ -88,7 +88,7 @@ def test_fromobject(self):
8888
8989 def test_size (self ):
9090 # Test PyBytes_Size()
91- size = _testcapi .bytes_size
91+ size = _testlimitedcapi .bytes_size
9292
9393 self .assertEqual (size (b'abc' ), 3 )
9494 self .assertEqual (size (BytesSubclass (b'abc' )), 3 )
@@ -100,7 +100,7 @@ def test_size(self):
100100
101101 def test_asstring (self ):
102102 """Test PyBytes_AsString()"""
103- asstring = _testcapi .bytes_asstring
103+ asstring = _testlimitedcapi .bytes_asstring
104104
105105 self .assertEqual (asstring (b'abc' , 4 ), b'abc\0 ' )
106106 self .assertEqual (asstring (b'abc\0 def' , 8 ), b'abc\0 def\0 ' )
@@ -111,8 +111,8 @@ def test_asstring(self):
111111
112112 def test_asstringandsize (self ):
113113 """Test PyBytes_AsStringAndSize()"""
114- asstringandsize = _testcapi .bytes_asstringandsize
115- asstringandsize_null = _testcapi .bytes_asstringandsize_null
114+ asstringandsize = _testlimitedcapi .bytes_asstringandsize
115+ asstringandsize_null = _testlimitedcapi .bytes_asstringandsize_null
116116
117117 self .assertEqual (asstringandsize (b'abc' , 4 ), (b'abc\0 ' , 3 ))
118118 self .assertEqual (asstringandsize (b'abc\0 def' , 8 ), (b'abc\0 def\0 ' , 7 ))
@@ -128,7 +128,7 @@ def test_asstringandsize(self):
128128
129129 def test_repr (self ):
130130 # Test PyBytes_Repr()
131- bytes_repr = _testcapi .bytes_repr
131+ bytes_repr = _testlimitedcapi .bytes_repr
132132
133133 self .assertEqual (bytes_repr (b'''abc''' , 0 ), r"""b'abc'""" )
134134 self .assertEqual (bytes_repr (b'''abc''' , 1 ), r"""b'abc'""" )
@@ -149,7 +149,7 @@ def test_repr(self):
149149 def test_concat (self , concat = None ):
150150 """Test PyBytes_Concat()"""
151151 if concat is None :
152- concat = _testcapi .bytes_concat
152+ concat = _testlimitedcapi .bytes_concat
153153
154154 self .assertEqual (concat (b'abc' , b'def' ), b'abcdef' )
155155 self .assertEqual (concat (b'a\0 b' , b'c\0 d' ), b'a\0 bc\0 d' )
@@ -182,11 +182,11 @@ def test_concat(self, concat=None):
182182
183183 def test_concatanddel (self ):
184184 """Test PyBytes_ConcatAndDel()"""
185- self .test_concat (_testcapi .bytes_concatanddel )
185+ self .test_concat (_testlimitedcapi .bytes_concatanddel )
186186
187187 def test_decodeescape (self ):
188188 """Test PyBytes_DecodeEscape()"""
189- decodeescape = _testcapi .bytes_decodeescape
189+ decodeescape = _testlimitedcapi .bytes_decodeescape
190190
191191 self .assertEqual (decodeescape (b'abc' ), b'abc' )
192192 self .assertEqual (decodeescape (br'\t\n\r\x0b\x0c\x00\\\'\"' ),
0 commit comments