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

Function test_schema_from_mapping

python/pyarrow/tests/test_schema.py:364–382  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

362
363
364def test_schema_from_mapping():
365 fields = OrderedDict([
366 ('foo', pa.int32()),
367 ('bar', pa.string()),
368 ('baz', pa.list_(pa.int8())),
369 ])
370 sch = pa.schema(fields)
371 assert sch.names == ['foo', 'bar', 'baz']
372 assert sch.types == [pa.int32(), pa.string(), pa.list_(pa.int8())]
373 assert len(sch) == 3
374 assert repr(sch) == """\
375foo: int32
376bar: string
377baz: list<item: int8>
378 child 0, item: int8"""
379
380 fields = OrderedDict([('foo', None)])
381 with pytest.raises(TypeError):
382 pa.schema(fields)
383
384
385def test_schema_duplicate_fields():

Callers

nothing calls this directly

Calls 3

lenFunction · 0.85
stringMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected