diff --git a/snakebids/core/input_generation.py b/snakebids/core/input_generation.py index 1f1c7036..587e7be9 100644 --- a/snakebids/core/input_generation.py +++ b/snakebids/core/input_generation.py @@ -689,7 +689,13 @@ def from_filter_dict( Intended primarily for use in testing """ - return cls({"filters": filters}, postfilter or _Postfilter()) + wildcards: list[str] = [] + if postfilter is not None: + wildcards.extend(postfilter.inclusions) + wildcards.extend(postfilter.exclusions) + return cls( + {"filters": filters, "wildcards": wildcards}, postfilter or _Postfilter() + ) def _has_empty_list(self, items: Iterable[Any]): """Check if any of the lists within iterable are empty""" diff --git a/snakebids/tests/test_generate_inputs.py b/snakebids/tests/test_generate_inputs.py index 17f78a45..41ede694 100644 --- a/snakebids/tests/test_generate_inputs.py +++ b/snakebids/tests/test_generate_inputs.py @@ -13,16 +13,7 @@ import warnings from collections import defaultdict from pathlib import Path -from typing import ( - Any, - Callable, - Iterable, - Literal, - NamedTuple, - TypedDict, - TypeVar, - cast, -) +from typing import Iterable, Literal, NamedTuple, TypedDict, TypeVar, cast import attrs import more_itertools as itx @@ -50,11 +41,11 @@ from snakebids.paths.presets import bids from snakebids.tests import strategies as sb_st from snakebids.tests.helpers import ( + Benchmark, BidsListCompare, allow_function_scoped, create_dataset, create_snakebids_config, - debug, example_if, get_bids_path, get_zip_list, @@ -699,13 +690,11 @@ def generate_test_directory( T = TypeVar("T") - def test_benchmark_test_custom_paths( - self, benchmark: Callable[[Callable[..., Any], Any], Any], tmp_path: Path - ): + def test_benchmark_test_custom_paths(self, benchmark: Benchmark, tmp_path: Path): entities = {"A": ["A", "B", "C"], "B": ["1", "2", "3"]} template = Path("{A}/A-{A}_B-{B}") test_path = self.generate_test_directory(entities, template, tmp_path) - benchmark(_parse_custom_path, test_path) + benchmark(_parse_custom_path, test_path, _UnifiedFilter.from_filter_dict({})) @allow_function_scoped @given(path_entities=path_entities()) @@ -754,11 +743,6 @@ def test_collects_only_filtered_entities( name="foo", path=get_bids_path(result_filtered), zip_lists=result_filtered ) - @debug( - path_entities=PathEntities( - entities={"A": ["A"]}, template=Path("A-{A}"), filters={"A": ["A"]} - ), - ) @settings(deadline=400, suppress_health_check=[HealthCheck.function_scoped_fixture]) @given(path_entities=path_entities()) def test_collect_all_but_filters_when_exclusion_filters_used(