Skip to content

Commit

Permalink
fix: default match shouldn't match anything
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Dec 22, 2020
1 parent 927b732 commit 6f01d6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion beet/core/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def merge(
class MatchMixin:
def match(self: Mapping[str, Any], *patterns: str) -> Set[str]:
"""Return keys matching the given path patterns."""
spec = PathSpec.from_lines("gitwildmatch", patterns or ["*"])
spec = PathSpec.from_lines("gitwildmatch", patterns)
return set(spec.match_files(self.keys()))


Expand Down
8 changes: 6 additions & 2 deletions tests/test_data_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ def test_match():

funcs = [f"path/to/func_{i:02d}" for i in range(100)]

assert custom.functions.match() == set(funcs) | {
assert custom.functions.match() == set()

assert custom.functions.match("*") == set(funcs) | {
"path/to/end",
"other/subdir/hello",
"other/subdir/world",
Expand Down Expand Up @@ -227,7 +229,9 @@ def test_proxy_match():
custom_funcs = [f"custom:path/to/func_{i:02d}" for i in range(100)]
hey_funcs = [f"hey:path/to/func_{i:02d}" for i in range(100)]

assert pack.functions.match() == set(custom_funcs) | set(hey_funcs) | {
assert pack.functions.match() == set()

assert pack.functions.match("*") == set(custom_funcs) | set(hey_funcs) | {
"custom:path/to/end",
"custom:other/subdir/hello",
"custom:other/subdir/world",
Expand Down

0 comments on commit 6f01d6a

Please sign in to comment.