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

Function test_schema_hash_metadata

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

Source from the content-addressed store, hash-verified

477
478
479def test_schema_hash_metadata():
480 fields = [
481 pa.field("foo", pa.int32()),
482 ]
483
484 schema1 = pa.schema(fields, metadata={b'foo': b'bar'})
485 schema2 = pa.schema(fields, metadata={b'foo': b'bar'})
486 schema3 = pa.schema(fields, metadata={b'foo_different': b'bar'})
487 schema4 = pa.schema(fields, metadata={b'foo': b'bar_different'})
488
489 assert hash(schema1) == hash(schema2)
490 assert hash(schema1) != hash(schema3)
491 assert hash(schema1) != hash(schema4)
492 assert hash(schema3) != hash(schema4)
493
494 schema_empty1 = pa.schema(fields, metadata={})
495 schema_empty2 = pa.schema(fields, metadata=None)
496
497 assert hash(schema_empty1) == hash(schema_empty2)
498 assert hash(schema_empty1) != hash(schema1)
499
500
501def test_schema_equals():

Callers

nothing calls this directly

Calls 3

hashFunction · 0.85
fieldMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected