Skip to content

Commit 52fe847

Browse files
committed
Remove xxlimited import and update test for method_get with io.StringIO
1 parent 6799dd8 commit 52fe847

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Lib/test/test_descr.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828
except ImportError:
2929
xxsubtype = None
3030

31-
try:
32-
import xxlimited
33-
except ImportError:
34-
xxlimited = None
35-
3631

3732
class OperatorsTest(unittest.TestCase):
3833

@@ -1808,8 +1803,7 @@ class SubSpam(spam.spamlist): pass
18081803
spam_cm.__get__(None, list)
18091804
self.assertEqual(str(cm.exception), expected_errmsg)
18101805

1811-
@support.impl_detail("the module 'xxlimited' is internal")
1812-
@unittest.skipIf(xxlimited is None, "requires xxlimited module")
1806+
@support.cpython_only
18131807
def test_method_get_meth_method_invalid_type(self):
18141808
# gh-146615: method_get() for METH_METHOD descriptors used to pass
18151809
# Py_TYPE(type)->tp_name as the %V fallback instead of the separate
@@ -1819,14 +1813,16 @@ def test_method_get_meth_method_invalid_type(self):
18191813
#
18201814
# METH_METHOD|METH_FASTCALL|METH_KEYWORDS is the only flag combination
18211815
# that enters the affected branch in method_get().
1822-
xxo = xxlimited.Xxo()
1823-
descr = xxlimited.Xxo.demo
1816+
import io
1817+
1818+
obj = io.StringIO()
1819+
descr = io.TextIOBase.read
18241820

18251821
with self.assertRaises(TypeError) as cm:
1826-
descr.__get__(xxo, "not_a_type")
1822+
descr.__get__(obj, "not_a_type")
18271823
self.assertEqual(
18281824
str(cm.exception),
1829-
"descriptor 'demo' needs a type, not 'str', as arg 2",
1825+
"descriptor 'read' needs a type, not 'str', as arg 2",
18301826
)
18311827

18321828
def test_staticmethods(self):

0 commit comments

Comments
 (0)