|
32 | 32 | ArrowStringArray,
|
33 | 33 | StringArray,
|
34 | 34 | )
|
| 35 | +from pandas.core.arrays.string_arrow import ArrowStringArrayNumpySemantics |
35 | 36 |
|
36 | 37 | from pandas.io.common import get_handle
|
37 | 38 | from pandas.io.xml import read_xml
|
@@ -2004,7 +2005,9 @@ def test_s3_parser_consistency(s3_public_bucket_with_data, s3so):
|
2004 | 2005 | tm.assert_frame_equal(df_lxml, df_etree)
|
2005 | 2006 |
|
2006 | 2007 |
|
2007 |
| -def test_read_xml_nullable_dtypes(parser, string_storage, dtype_backend): |
| 2008 | +def test_read_xml_nullable_dtypes( |
| 2009 | + parser, string_storage, dtype_backend, using_infer_string |
| 2010 | +): |
2008 | 2011 | # GH#50500
|
2009 | 2012 | data = """<?xml version='1.0' encoding='utf-8'?>
|
2010 | 2013 | <data xmlns="http://example.com">
|
@@ -2032,7 +2035,12 @@ def test_read_xml_nullable_dtypes(parser, string_storage, dtype_backend):
|
2032 | 2035 | </row>
|
2033 | 2036 | </data>"""
|
2034 | 2037 |
|
2035 |
| - if string_storage == "python": |
| 2038 | + if using_infer_string: |
| 2039 | + pa = pytest.importorskip("pyarrow") |
| 2040 | + string_array = ArrowStringArrayNumpySemantics(pa.array(["x", "y"])) |
| 2041 | + string_array_na = ArrowStringArrayNumpySemantics(pa.array(["x", None])) |
| 2042 | + |
| 2043 | + elif string_storage == "python": |
2036 | 2044 | string_array = StringArray(np.array(["x", "y"], dtype=np.object_))
|
2037 | 2045 | string_array_na = StringArray(np.array(["x", NA], dtype=np.object_))
|
2038 | 2046 |
|
|
0 commit comments