Skip to content

Commit cc601d6

Browse files
committed
test(indexing): integration test for two schemas in one process
1 parent 5e98d72 commit cc601d6

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/test_indexing.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,23 @@ def test_batch_index_dataset_with_explicit_schema():
302302
assert len(tables) == len(roots)
303303
for t in tables:
304304
assert "sub" in t.schema.names
305+
306+
307+
def test_two_schemas_one_process_produce_distinct_metadata():
308+
"""Two BIDSSchema instances yield index tables with distinguishable schemas.
309+
310+
Distinguish via a custom marker injected into one BIDSSchema's arrow_schema
311+
metadata. The non-marked schema must not pick up the marker.
312+
"""
313+
base = BIDSSchema.from_path(None)
314+
base_md = {k.decode(): v.decode() for k, v in base.arrow_schema.metadata.items()}
315+
tagged_arrow = base.arrow_schema.with_metadata({**base_md, "test_marker": "tagged"})
316+
tagged = BIDSSchema.from_arrow(tagged_arrow)
317+
318+
dataset_root = BIDS_EXAMPLES / "ds102"
319+
320+
t_base = indexing.index_dataset(dataset_root, schema=base, max_workers=0)
321+
t_tag = indexing.index_dataset(dataset_root, schema=tagged, max_workers=0)
322+
323+
assert b"test_marker" not in (t_base.schema.metadata or {})
324+
assert t_tag.schema.metadata[b"test_marker"] == b"tagged"

0 commit comments

Comments
 (0)