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

Function test_schema

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

Source from the content-addressed store, hash-verified

230
231
232def test_schema():
233 fields = [
234 pa.field('foo', pa.int32()),
235 pa.field('bar', pa.string()),
236 pa.field('baz', pa.list_(pa.int8()))
237 ]
238 sch = pa.schema(fields)
239
240 assert sch.names == ['foo', 'bar', 'baz']
241 assert sch.types == [pa.int32(), pa.string(), pa.list_(pa.int8())]
242
243 assert len(sch) == 3
244 assert sch[0].name == 'foo'
245 assert sch[0].type == fields[0].type
246 assert sch.field('foo').name == 'foo'
247 assert sch.field('foo').type == fields[0].type
248
249 assert repr(sch) == """\
250foo: int32
251bar: string
252baz: list<item: int8>
253 child 0, item: int8"""
254
255 with pytest.raises(TypeError):
256 pa.schema([None])
257
258
259def test_schema_weakref():

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
fieldMethod · 0.45
stringMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected