Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pandas/tests/io/xml/test_to_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,9 +1037,16 @@ def test_stylesheet_wrong_path():
def test_empty_string_stylesheet(val):
from lxml.etree import XMLSyntaxError

with pytest.raises(
XMLSyntaxError, match=("Document is empty|Start tag expected, '<' not found")
):
msg = "|".join(
[
"Document is empty",
"Start tag expected, '<' not found",
# Seen on Mac with lxml 4.9.1
r"None \(line 0\)",
]
)

with pytest.raises(XMLSyntaxError, match=msg):
geom_df.to_xml(stylesheet=val)


Expand Down
9 changes: 8 additions & 1 deletion pandas/tests/io/xml/test_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,14 @@ def test_file_handle_close(datapath, parser):
def test_empty_string_lxml(val):
from lxml.etree import XMLSyntaxError

with pytest.raises(XMLSyntaxError, match="Document is empty"):
msg = "|".join(
[
"Document is empty",
# Seen on Mac with lxml 4.91
r"None \(line 0\)",
]
)
with pytest.raises(XMLSyntaxError, match=msg):
read_xml(val, parser="lxml")


Expand Down