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

Function test_schema_get_fields

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

Source from the content-addressed store, hash-verified

573
574
575def test_schema_get_fields():
576 fields = [
577 pa.field('foo', pa.int32()),
578 pa.field('bar', pa.string()),
579 pa.field('baz', pa.list_(pa.int8()))
580 ]
581
582 schema = pa.schema(fields)
583
584 assert schema.field('foo').name == 'foo'
585 assert schema.field(0).name == 'foo'
586 assert schema.field(-1).name == 'baz'
587
588 with pytest.raises(KeyError):
589 schema.field('other')
590 with pytest.raises(TypeError):
591 schema.field(0.0)
592 with pytest.raises(IndexError):
593 schema.field(4)
594
595
596def test_schema_negative_indexing():

Callers

nothing calls this directly

Calls 3

fieldMethod · 0.45
stringMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected