Skip to content

Commit 722fbc3

Browse files
Backport PR #49286 on branch 1.5.x (TST: update exception messages for lxml tests) (#49303)
Backport PR #49286: TST: update exception messages for lxml tests Co-authored-by: jbrockmendel <[email protected]>
1 parent 4258f50 commit 722fbc3

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

pandas/tests/io/xml/test_to_xml.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,16 @@ def test_stylesheet_wrong_path():
10371037
def test_empty_string_stylesheet(val):
10381038
from lxml.etree import XMLSyntaxError
10391039

1040-
with pytest.raises(
1041-
XMLSyntaxError, match=("Document is empty|Start tag expected, '<' not found")
1042-
):
1040+
msg = "|".join(
1041+
[
1042+
"Document is empty",
1043+
"Start tag expected, '<' not found",
1044+
# Seen on Mac with lxml 4.9.1
1045+
r"None \(line 0\)",
1046+
]
1047+
)
1048+
1049+
with pytest.raises(XMLSyntaxError, match=msg):
10431050
geom_df.to_xml(stylesheet=val)
10441051

10451052

pandas/tests/io/xml/test_xml.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,14 @@ def test_file_handle_close(datapath, parser):
471471
def test_empty_string_lxml(val):
472472
from lxml.etree import XMLSyntaxError
473473

474-
with pytest.raises(XMLSyntaxError, match="Document is empty"):
474+
msg = "|".join(
475+
[
476+
"Document is empty",
477+
# Seen on Mac with lxml 4.91
478+
r"None \(line 0\)",
479+
]
480+
)
481+
with pytest.raises(XMLSyntaxError, match=msg):
475482
read_xml(val, parser="lxml")
476483

477484

0 commit comments

Comments
 (0)