Skip to content

Commit

Permalink
Use AssetSelection.key_substring
Browse files Browse the repository at this point in the history
  • Loading branch information
briantu committed Nov 14, 2024
1 parent da5f8cb commit fe35c76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def visitKeyExpr(self, ctx: AssetSelectionParser.KeyExprContext):
value = self.visit(ctx.value())
return AssetSelection.assets(value)

def visitKeySubsetExpr(self, ctx: AssetSelectionParser.KeySubsetExprContext):
def visitKeySubstringExpr(self, ctx: AssetSelectionParser.KeySubstringExprContext):
value = self.visit(ctx.value())
return AssetSelection.key_prefixes(value)
return AssetSelection.key_substring(value)

def visitTagAttributeExpr(self, ctx: AssetSelectionParser.TagAttributeExprContext):
key = self.visit(ctx.value(0))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def test_antlr_tree_invalid(selection_str):
"selection_str, expected_assets",
[
("key:a", AssetSelection.assets("a")),
('key:"*/a+"', AssetSelection.assets("*/a+")),
("key_substring:a", AssetSelection.key_substring("a")),
('key_substring:"*/a+"', AssetSelection.key_substring("*/a+")),
("not key:a", AssetSelection.all(include_sources=True) - AssetSelection.assets("a")),
("key:a and key:b", AssetSelection.assets("a") & AssetSelection.assets("b")),
("key:a or key:b", AssetSelection.assets("a") | AssetSelection.assets("b")),
Expand Down

0 comments on commit fe35c76

Please sign in to comment.