Skip to content

Commit 8389d4d

Browse files
committed
Add test for schema kwarg on batch_index_dataset
1 parent 4d8a627 commit 8389d4d

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/test_indexing.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,19 @@ def test_index_dataset_propagates_schema_to_workers(tmp_path):
284284
table = index_dataset(tmp_path / "ds", schema=ns, max_workers=2, chunksize=1)
285285
assert table.num_rows == 1
286286
assert table.schema.field("sub").metadata[b"description"] == b"Modified again"
287+
288+
289+
def test_batch_index_dataset_accepts_schema_kwarg(tmp_path):
290+
from bids2table._indexing import batch_index_dataset
291+
292+
ds1 = tmp_path / "a"
293+
(ds1 / "sub-A01" / "anat").mkdir(parents=True)
294+
(ds1 / "dataset_description.json").write_text('{"Name": "a"}')
295+
(ds1 / "sub-A01" / "anat" / "sub-A01_T1w.nii.gz").touch()
296+
297+
ns = deepcopy(bidsschematools.schema.load_schema())
298+
ns.objects.entities.subject["description"] = "And again"
299+
tables = list(batch_index_dataset([ds1], schema=ns))
300+
assert len(tables) == 1
301+
assert tables[0].num_rows == 1
302+
assert tables[0].schema.field("sub").metadata[b"description"] == b"And again"

0 commit comments

Comments
 (0)