(uint, int, float, np_float_str,
unit, tz, offset, length)
| 347 | @pytest.mark.parametrize("tz", ['America/New_York', '+07:30', '-04:30']) |
| 348 | @pytest.mark.parametrize("offset, length", [(0, 3), (0, 2), (1, 2), (2, 1)]) |
| 349 | def test_pyarrow_roundtrip(uint, int, float, np_float_str, |
| 350 | unit, tz, offset, length): |
| 351 | |
| 352 | from datetime import datetime as dt |
| 353 | arr = [1, 2, None] |
| 354 | dt_arr = [dt(2007, 7, 13), None, dt(2007, 7, 15)] |
| 355 | |
| 356 | table = pa.table( |
| 357 | { |
| 358 | "a": pa.array(arr, type=uint), |
| 359 | "b": pa.array(arr, type=int), |
| 360 | "c": pa.array(np.array(arr, dtype=np.dtype(np_float_str)), |
| 361 | type=float, from_pandas=True), |
| 362 | "d": [True, False, True], |
| 363 | "e": [True, False, None], |
| 364 | "f": ["a", None, "c"], |
| 365 | "g": pa.array(dt_arr, type=pa.timestamp(unit, tz=tz)) |
| 366 | } |
| 367 | ) |
| 368 | table = table.slice(offset, length) |
| 369 | result = _from_dataframe(table.__dataframe__()) |
| 370 | |
| 371 | assert table.equals(result) |
| 372 | |
| 373 | table_protocol = table.__dataframe__() |
| 374 | result_protocol = result.__dataframe__() |
| 375 | |
| 376 | assert table_protocol.num_columns() == result_protocol.num_columns() |
| 377 | assert table_protocol.num_rows() == result_protocol.num_rows() |
| 378 | assert table_protocol.num_chunks() == result_protocol.num_chunks() |
| 379 | assert table_protocol.column_names() == result_protocol.column_names() |
| 380 | |
| 381 | |
| 382 | @pytest.mark.parametrize("offset, length", [(0, 10), (0, 2), (7, 3), (2, 1)]) |
nothing calls this directly
no test coverage detected