Skip to content

Commit

Permalink
include grammar file
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzon committed Nov 20, 2024
1 parent 8f583c0 commit 3b92125
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ lint: venv ## Run code linter to check code style and check if formatte
($(VENV_RUN); python -m ruff check --show-source . && python -m black --check .)

install: venv
$(VENV_RUN); $(PIP_CMD) install -e .
$(VENV_RUN); $(PIP_CMD) install -e ".[test,dev]"

test: venv ## Run tests
($(VENV_RUN); python -m pytest -v --cov=plux --cov-report=term-missing --cov-report=xml tests)
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "aws-json-term-matcher"
version = "0.1.2"
version = "0.1.3"
authors = [
{ name = 'Cristopher Pinzon', email = '[email protected]' }
]
Expand Down Expand Up @@ -33,3 +33,9 @@ test = [

[project.urls]
Repository = "https://github.com/pinzon/aws-json-term-matcher.git"

[tool.setuptools]
include-package-data = true

[tool.setuptools.package-data]
"aws_json_term_matcher" = ["grammar.lark"]
4 changes: 3 additions & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
# real life sample with arn
'{($.detail-type ="ShopUnavailable") && (($.resources[1] = "arn:aws:states:us-east-1:111222333444:execution:OrderProcessorWorkflow:d57d4769-72fd") || ($.resources[0] = "arn:aws:states:us-east-1:111222333444:stateMachine:OrderProcessorWorkflow"))}',
'{ $.number[0][1]["test"].test = 1e-3 }',
'{ ($.detail-type = "ShopUnavailable") && (($.resources[1] = "arn:aws:states:us-east-1:111222333444:execution:OrderProcessorWorkflow:d57d4769-72fd") || ($.resources[0] = "arn:aws:states:us-east-1:111222333444:execution:OrderProcessorWorkflow:d57d4769-72fd"))}'
]


@pytest.mark.parametrize("filter_definition", test_cases)
def test_parse_filter(filter_definition):
assert parse_filter(filter_definition)
result = parse_filter(filter_definition)
assert result


error_cases = [
Expand Down

0 comments on commit 3b92125

Please sign in to comment.