core[patch]: fix xml output parser transform (#19530)

Previous PR passed _parser attribute which apparently is not meant to be
used by user code and causes non deterministic failures on CI when
testing the transform and a transform methods. Reverting this change
temporarily.
This commit is contained in:
Eugene Yurtsev
2024-03-25 17:34:45 -04:00
committed by GitHub
parent e6952b04d5
commit 56f4c5459b
2 changed files with 2 additions and 29 deletions

View File

@@ -1,6 +1,5 @@
"""Test XMLOutputParser"""
from typing import AsyncIterator
from xml.etree.ElementTree import ParseError
import pytest
@@ -100,17 +99,3 @@ async def tests_billion_laughs_attack() -> None:
with pytest.raises(OutputParserException):
await parser.aparse(MALICIOUS_XML)
with pytest.raises(ParseError):
# Right now raises undefined entity error
assert list(parser.transform(iter(MALICIOUS_XML))) == [
{"foo": [{"bar": [{"baz": None}]}]}
]
async def _as_iter(string: str) -> AsyncIterator[str]:
for c in string:
yield c
with pytest.raises(ParseError):
chunks = [chunk async for chunk in parser.atransform(_as_iter(MALICIOUS_XML))]
assert chunks == [{"foo": [{"bar": [{"baz": None}]}]}]