| 342 | |
| 343 | |
| 344 | def test_schema_from_tuples(): |
| 345 | fields = [ |
| 346 | ('foo', pa.int32()), |
| 347 | ('bar', pa.string()), |
| 348 | ('baz', pa.list_(pa.int8())), |
| 349 | ] |
| 350 | sch = pa.schema(fields) |
| 351 | assert sch.names == ['foo', 'bar', 'baz'] |
| 352 | assert sch.types == [pa.int32(), pa.string(), pa.list_(pa.int8())] |
| 353 | assert len(sch) == 3 |
| 354 | assert repr(sch) == """\ |
| 355 | foo: int32 |
| 356 | bar: string |
| 357 | baz: list<item: int8> |
| 358 | child 0, item: int8""" |
| 359 | |
| 360 | with pytest.raises(TypeError): |
| 361 | pa.schema([('foo', None)]) |
| 362 | |
| 363 | |
| 364 | def test_schema_from_mapping(): |