(self, temp_file, using_infer_string)
| 240 | read_feather(temp_file, dtype_backend="numpy") |
| 241 | |
| 242 | def test_string_inference(self, temp_file, using_infer_string): |
| 243 | # GH#54431 |
| 244 | df = pd.DataFrame(data={"a": ["x", "y"]}) |
| 245 | df.to_feather(temp_file) |
| 246 | with pd.option_context("future.infer_string", True): |
| 247 | result = read_feather(temp_file) |
| 248 | dtype = pd.StringDtype(na_value=np.nan) |
| 249 | expected = pd.DataFrame( |
| 250 | data={"a": ["x", "y"]}, dtype=pd.StringDtype(na_value=np.nan) |
| 251 | ) |
| 252 | expected = pd.DataFrame( |
| 253 | data={"a": ["x", "y"]}, |
| 254 | dtype=dtype, |
| 255 | columns=pd.Index( |
| 256 | ["a"], |
| 257 | dtype=object |
| 258 | if pa_version_under19p0 and not using_infer_string |
| 259 | else dtype, |
| 260 | ), |
| 261 | ) |
| 262 | tm.assert_frame_equal(result, expected) |
| 263 | |
| 264 | @pytest.mark.skipif(pa_version_under18p0, reason="not supported before 18.0") |
| 265 | def test_string_inference_string_view_type(self, temp_file): |
nothing calls this directly
no test coverage detected