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:2662–2679  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2660
2661
2662def test_table_factory_function_args():
2663 # from_pydict not accepting names:
2664 with pytest.raises(ValueError):
2665 pa.table({'a': [1, 2, 3]}, names=['a'])
2666
2667 # backwards compatibility for schema as first positional argument
2668 schema = pa.schema([('a', pa.int32())])
2669 table = pa.table({'a': pa.array([1, 2, 3], type=pa.int64())}, schema)
2670 assert table.column('a').type == pa.int32()
2671
2672 # from_arrays: accept both names and schema as positional first argument
2673 data = [pa.array([1, 2, 3], type='int64')]
2674 names = ['a']
2675 table = pa.table(data, names)
2676 assert table.column_names == names
2677 schema = pa.schema([('a', pa.int64())])
2678 table = pa.table(data, schema)
2679 assert table.column_names == names
2680
2681
2682@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