| 2620 | |
| 2621 | @pytest.mark.pandas |
| 2622 | def test_table_factory_function_args_pandas(): |
| 2623 | import pandas as pd |
| 2624 | |
| 2625 | # from_pandas not accepting names or metadata: |
| 2626 | with pytest.raises(ValueError): |
| 2627 | pa.table(pd.DataFrame({'a': [1, 2, 3]}), names=['a']) |
| 2628 | |
| 2629 | with pytest.raises(ValueError): |
| 2630 | pa.table(pd.DataFrame({'a': [1, 2, 3]}), metadata={b'foo': b'bar'}) |
| 2631 | |
| 2632 | # backwards compatibility for schema as first positional argument |
| 2633 | schema = pa.schema([('a', pa.int32())]) |
| 2634 | table = pa.table(pd.DataFrame({'a': [1, 2, 3]}), schema) |
| 2635 | assert table.column('a').type == pa.int32() |
| 2636 | |
| 2637 | |
| 2638 | def test_factory_functions_invalid_input(): |