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

Function test_schema_equality_operators

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

Source from the content-addressed store, hash-verified

546
547
548def test_schema_equality_operators():
549 fields = [
550 pa.field('foo', pa.int32()),
551 pa.field('bar', pa.string()),
552 pa.field('baz', pa.list_(pa.int8()))
553 ]
554 metadata = {b'foo': b'bar', b'pandas': b'badger'}
555
556 sch1 = pa.schema(fields)
557 sch2 = pa.schema(fields)
558 sch3 = pa.schema(fields, metadata=metadata)
559 sch4 = pa.schema(fields, metadata=metadata)
560
561 assert sch1 == sch2
562 assert sch3 == sch4
563
564 # __eq__ and __ne__ do not check metadata
565 assert sch1 == sch3
566 assert not sch1 != sch3
567
568 assert sch2 == sch4
569
570 # comparison with other types doesn't raise
571 assert sch1 != []
572 assert sch3 != 'foo'
573
574
575def test_schema_get_fields():

Callers

nothing calls this directly

Calls 3

fieldMethod · 0.45
stringMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected