(uint, int, float, np_float_str,
unit, tz, offset, length)
| 390 | @pytest.mark.parametrize("tz", ['America/New_York', '+07:30', '-04:30']) |
| 391 | @pytest.mark.parametrize("offset, length", [(0, 3), (0, 2), (1, 2), (2, 1)]) |
| 392 | def test_pyarrow_roundtrip(uint, int, float, np_float_str, |
| 393 | unit, tz, offset, length): |
| 394 | |
| 395 | from datetime import datetime as dt |
| 396 | arr = [1, 2, None] |
| 397 | dt_arr = [dt(2007, 7, 13), None, dt(2007, 7, 15)] |
| 398 | |
| 399 | table = pa.table( |
| 400 | { |
| 401 | "a": pa.array(arr, type=uint), |
| 402 | "b": pa.array(arr, type=int), |
| 403 | "c": pa.array(np.array(arr, dtype=np.dtype(np_float_str)), |
| 404 | type=float, from_pandas=True), |
| 405 | "d": [True, False, True], |
| 406 | "e": [True, False, None], |
| 407 | "f": ["a", None, "c"], |
| 408 | "g": pa.array(dt_arr, type=pa.timestamp(unit, tz=tz)) |
| 409 | } |
| 410 | ) |
| 411 | table = table.slice(offset, length) |
| 412 | result = _from_dataframe(table.__dataframe__()) |
| 413 | |
| 414 | assert table.equals(result) |
| 415 | |
| 416 | table_protocol = table.__dataframe__() |
| 417 | result_protocol = result.__dataframe__() |
| 418 | |
| 419 | assert table_protocol.num_columns() == result_protocol.num_columns() |
| 420 | assert table_protocol.num_rows() == result_protocol.num_rows() |
| 421 | assert table_protocol.num_chunks() == result_protocol.num_chunks() |
| 422 | assert table_protocol.column_names() == result_protocol.column_names() |
| 423 | |
| 424 | |
| 425 | @pytest.mark.parametrize("offset, length", [(0, 10), (0, 2), (7, 3), (2, 1)]) |
nothing calls this directly
no test coverage detected