Skip to content

Commit 580974b

Browse files
committed
test(filetree): Initial tests
1 parent a6329a4 commit 580974b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

tests/types/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Tests for bids_validator.types."""

tests/types/test_files.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Tests for bids_validator.types.files."""
2+
3+
import attrs
4+
from bids_validator.types.files import FileTree
5+
6+
7+
def test_FileTree(examples):
8+
"""Test the FileTree class."""
9+
ds000117 = FileTree.read_from_filesystem(examples / 'ds000117')
10+
assert 'sub-01/ses-mri/anat/sub-01_ses-mri_acq-mprage_T1w.nii.gz' in ds000117
11+
assert ds000117.children['sub-01'].parent is ds000117
12+
13+
# Verify that evolving FileTrees creates consistent structures
14+
evolved = attrs.evolve(ds000117)
15+
assert evolved.children['sub-01'].parent is not ds000117
16+
assert evolved.children['sub-01'].parent is evolved
17+
assert evolved.children['sub-01'].children['ses-mri'].parent is not ds000117.children['sub-01']
18+
assert evolved.children['sub-01'].children['ses-mri'].parent is evolved.children['sub-01']

0 commit comments

Comments
 (0)