Description
See: https://bugzilla.redhat.com/show_bug.cgi?id=2323166
=================================== FAILURES ===================================
___________ CollectionsBrain.test_collections_object_subscriptable_3 ___________
args = (<Attribute.ByteString l.3 at 0x7f75c592dbd0>,)
kwargs = {'context': <astroid.context.InferenceContext object at 0x7f75c59adae0>}
generator = <generator object Attribute._infer at 0x7f75c591cbf0>
def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
generator = func(*args, **kwargs)
try:
yield next(generator)
E StopIteration
astroid/decorators.py:86: StopIteration
The above exception was the direct cause of the following exception:
self = <tests.brain.test_brain.CollectionsBrain testMethod=test_collections_object_subscriptable_3>
def test_collections_object_subscriptable_3(self):
"""With Python 3.9 the ByteString class of the collections module is subscriptable
(but not the same class from typing module)"""
right_node = builder.extract_node(
"""
import collections.abc
collections.abc.ByteString[int]
"""
)
inferred = next(right_node.infer())
tests/brain/test_brain.py:331:
astroid/nodes/node_ng.py:168: in infer
for i, result in enumerate(self._infer(context=context, **kwargs)):
astroid/decorators.py:86: in inner
yield next(generator)
astroid/decorators.py:49: in wrapped
for res in _func(node, context, **kwargs):
astroid/nodes/node_classes.py:3724: in _infer_subscript
for value in self.value.infer(context):
astroid/nodes/node_ng.py:168: in infer
for i, result in enumerate(self._infer(context=context, **kwargs)):
args = (<Attribute.ByteString l.3 at 0x7f75c592dbd0>,)
kwargs = {'context': <astroid.context.InferenceContext object at 0x7f75c59adae0>}
generator = <generator object Attribute._infer at 0x7f75c591cbf0>
def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
generator = func(*args, **kwargs)
try:
yield next(generator)
except StopIteration as error:
# generator is empty
if error.args:
raise InferenceError(**error.args[0]) from error
raise InferenceError(
"StopIteration raised without any error information."
) from error
E astroid.exceptions.InferenceError: StopIteration raised without any error information.
astroid/decorators.py:91: InferenceError
______________ TypingBrain.test_typing_object_notsubscriptable_3 _______________
args = (<Attribute.ByteString l.3 at 0x7f75c586d630>,)
kwargs = {'context': <astroid.context.InferenceContext object at 0x7f75c6386260>}
generator = <generator object Attribute._infer at 0x7f75c509d030>
def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
generator = func(*args, **kwargs)
try:
yield next(generator)
E StopIteration
astroid/decorators.py:86: StopIteration
The above exception was the direct cause of the following exception:
self = <tests.brain.test_brain.TypingBrain testMethod=test_typing_object_notsubscriptable_3>
def test_typing_object_notsubscriptable_3(self):
"""Until python39 ByteString class of the typing module is not
subscriptable (whereas it is in the collections' module)"""
right_node = builder.extract_node(
"""
import typing
typing.ByteString
"""
)
inferred = next(right_node.infer())
tests/brain/test_brain.py:914:
astroid/nodes/node_ng.py:168: in infer
for i, result in enumerate(self._infer(context=context, **kwargs)):
args = (<Attribute.ByteString l.3 at 0x7f75c586d630>,)
kwargs = {'context': <astroid.context.InferenceContext object at 0x7f75c6386260>}
generator = <generator object Attribute._infer at 0x7f75c509d030>
def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
generator = func(*args, **kwargs)
try:
yield next(generator)
except StopIteration as error:
# generator is empty
if error.args:
raise InferenceError(**error.args[0]) from error
raise InferenceError(
"StopIteration raised without any error information."
) from error
E astroid.exceptions.InferenceError: StopIteration raised without any error information.
astroid/decorators.py:91: InferenceError
=========================== short test summary info ============================
FAILED tests/brain/test_brain.py::CollectionsBrain::test_collections_object_subscriptable_3
FAILED tests/brain/test_brain.py::TypingBrain::test_typing_object_notsubscriptable_3
==== 2 failed, 1601 passed, 78 skipped, 7 deselected, 15 xfailed in 41.07s =====