Skip to content

Commit

Permalink
Adjust tests in xml folder for new string option (#56198)
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl authored Nov 27, 2023
1 parent 762b61d commit 52ddb2e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pandas/tests/io/xml/test_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
ArrowStringArray,
StringArray,
)
from pandas.core.arrays.string_arrow import ArrowStringArrayNumpySemantics

from pandas.io.common import get_handle
from pandas.io.xml import read_xml
Expand Down Expand Up @@ -2004,7 +2005,9 @@ def test_s3_parser_consistency(s3_public_bucket_with_data, s3so):
tm.assert_frame_equal(df_lxml, df_etree)


def test_read_xml_nullable_dtypes(parser, string_storage, dtype_backend):
def test_read_xml_nullable_dtypes(
parser, string_storage, dtype_backend, using_infer_string
):
# GH#50500
data = """<?xml version='1.0' encoding='utf-8'?>
<data xmlns="http://example.com">
Expand Down Expand Up @@ -2032,7 +2035,12 @@ def test_read_xml_nullable_dtypes(parser, string_storage, dtype_backend):
</row>
</data>"""

if string_storage == "python":
if using_infer_string:
pa = pytest.importorskip("pyarrow")
string_array = ArrowStringArrayNumpySemantics(pa.array(["x", "y"]))
string_array_na = ArrowStringArrayNumpySemantics(pa.array(["x", None]))

elif string_storage == "python":
string_array = StringArray(np.array(["x", "y"], dtype=np.object_))
string_array_na = StringArray(np.array(["x", NA], dtype=np.object_))

Expand Down

0 comments on commit 52ddb2e

Please sign in to comment.