MCPcopy Create free account
hub / github.com/apache/arrow / test_table_factory_function_args

Function test_table_factory_function_args

python/pyarrow/tests/test_table.py:2601–2618  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2599
2600
2601def test_table_factory_function_args():
2602 # from_pydict not accepting names:
2603 with pytest.raises(ValueError):
2604 pa.table({'a': [1, 2, 3]}, names=['a'])
2605
2606 # backwards compatibility for schema as first positional argument
2607 schema = pa.schema([('a', pa.int32())])
2608 table = pa.table({'a': pa.array([1, 2, 3], type=pa.int64())}, schema)
2609 assert table.column('a').type == pa.int32()
2610
2611 # from_arrays: accept both names and schema as positional first argument
2612 data = [pa.array([1, 2, 3], type='int64')]
2613 names = ['a']
2614 table = pa.table(data, names)
2615 assert table.column_names == names
2616 schema = pa.schema([('a', pa.int64())])
2617 table = pa.table(data, schema)
2618 assert table.column_names == names
2619
2620
2621@pytest.mark.pandas

Callers

nothing calls this directly

Calls 3

schemaMethod · 0.45
arrayMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected