Skip to content

Commit 875c57c

Browse files
committed
TEST: Test wildcard expansion
1 parent 91de0e9 commit 875c57c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

bids/modeling/tests/test_statsmodels.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pytest
1111

1212
from bids.modeling import BIDSStatsModelsGraph
13-
from bids.modeling.statsmodels import ContrastInfo
13+
from bids.modeling.statsmodels import ContrastInfo, expand_wildcards
1414
from bids.layout import BIDSLayout
1515
from bids.tests import get_test_data_path
1616
from bids.variables import BIDSVariableCollection
@@ -152,3 +152,20 @@ def test_entire_graph_smoketest(graph):
152152
assert model_spec.X.shape == (2, 1)
153153
assert model_spec.Z is None
154154
assert not set(model_spec.terms.keys()) - {"RT", "gain", "RT:gain"}
155+
156+
157+
def test_expand_wildcards():
158+
# No wildcards == no modification
159+
assert expand_wildcards(["a", "b"], ["a", "c"]) == ["a", "b"]
160+
# No matches == removal
161+
assert expand_wildcards(["a", "b*"], ["a", "c"]) == ["a"]
162+
# Matches expand in-place
163+
assert expand_wildcards(["a*", "b"], ["a", "c"]) == ["a", "b"]
164+
assert expand_wildcards(["a*", "b"], ["a0", "c", "a1", "a2"]) == ["a0", "a1", "a2", "b"]
165+
# Some examples
166+
assert expand_wildcards(
167+
["trial_type.*"], ["trial_type.A", "trial_type.B"]
168+
) == ["trial_type.A", "trial_type.B"]
169+
assert expand_wildcards(
170+
["non_steady_state*"], ["non_steady_state00", "non_steady_state01"]
171+
) == ["non_steady_state00", "non_steady_state01"]

0 commit comments

Comments
 (0)