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

Function test_schema_hash_metadata

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

Source from the content-addressed store, hash-verified

483
484
485def test_schema_hash_metadata():
486 fields = [
487 pa.field("foo", pa.int32()),
488 ]
489
490 schema1 = pa.schema(fields, metadata={b'foo': b'bar'})
491 schema2 = pa.schema(fields, metadata={b'foo': b'bar'})
492 schema3 = pa.schema(fields, metadata={b'foo_different': b'bar'})
493 schema4 = pa.schema(fields, metadata={b'foo': b'bar_different'})
494
495 assert hash(schema1) == hash(schema2)
496 assert hash(schema1) != hash(schema3)
497 assert hash(schema1) != hash(schema4)
498 assert hash(schema3) != hash(schema4)
499
500 schema_empty1 = pa.schema(fields, metadata={})
501 schema_empty2 = pa.schema(fields, metadata=None)
502
503 assert hash(schema_empty1) == hash(schema_empty2)
504 assert hash(schema_empty1) != hash(schema1)
505
506
507def 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