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

Function test_schema_equals

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

Source from the content-addressed store, hash-verified

499
500
501def test_schema_equals():
502 fields = [
503 pa.field('foo', pa.int32()),
504 pa.field('bar', pa.string()),
505 pa.field('baz', pa.list_(pa.int8()))
506 ]
507 metadata = {b'foo': b'bar', b'pandas': b'badger'}
508
509 sch1 = pa.schema(fields)
510 sch2 = pa.schema(fields)
511 sch3 = pa.schema(fields, metadata=metadata)
512 sch4 = pa.schema(fields, metadata=metadata)
513
514 assert sch1.equals(sch2, check_metadata=True)
515 assert sch3.equals(sch4, check_metadata=True)
516 assert sch1.equals(sch3)
517 assert not sch1.equals(sch3, check_metadata=True)
518 assert not sch1.equals(sch3, check_metadata=True)
519
520 del fields[-1]
521 sch3 = pa.schema(fields)
522 assert not sch1.equals(sch3)
523
524
525def test_schema_equals_propagates_check_metadata():

Callers

nothing calls this directly

Calls 4

equalsMethod · 0.80
fieldMethod · 0.45
stringMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected