|
10 | 10 | import pytest |
11 | 11 |
|
12 | 12 | from bids.modeling import BIDSStatsModelsGraph |
13 | | -from bids.modeling.statsmodels import ContrastInfo |
| 13 | +from bids.modeling.statsmodels import ContrastInfo, expand_wildcards |
14 | 14 | from bids.layout import BIDSLayout |
15 | 15 | from bids.tests import get_test_data_path |
16 | 16 | from bids.variables import BIDSVariableCollection |
@@ -152,3 +152,20 @@ def test_entire_graph_smoketest(graph): |
152 | 152 | assert model_spec.X.shape == (2, 1) |
153 | 153 | assert model_spec.Z is None |
154 | 154 | 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