Skip to content

Commit

Permalink
dev: Use ruff on tests too.
Browse files Browse the repository at this point in the history
  • Loading branch information
wxgeo committed Jan 20, 2024
1 parent 2c6a939 commit 37402cb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ build: version

publish: build
poetry publish

fix:
poetry run black .
poetry run ruff --fix ptyx tests

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ line-length = 110

[tool.tox]
legacy_tox_ini = """
[tox]
skipsdist = true
isolated_build = True
Expand All @@ -59,7 +60,7 @@ envlist = py311
allowlist_externals = poetry
commands =
poetry install -v
poetry run ruff ptyx
poetry run pytest tests
poetry run ruff ptyx tests
poetry run mypy ptyx tests
poetry run pytest tests
"""
5 changes: 4 additions & 1 deletion tests/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def test_syntax_tree():
""".strip()
assert s.syntax_tree.display(color=False) == tree

text = "#IF{a>0}some text here#ELIF{b>0}some more text#ELSE variable value is #variable not #{variable+1} !#END"
text = (
"#IF{a>0}some text here#ELIF{b>0}some more text"
"#ELSE variable value is #variable not #{variable+1} !#END"
)
s.generate_tree(text)
tree = """
+ Node ROOT
Expand Down
5 changes: 4 additions & 1 deletion tests/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ def test_IF_ELIF_ELSE():


def test_MACRO(compiler):
code = r"#MACRO{a0}#IF{a==0}$a=0$#ELSE$a\neq 0$#END#END_MACRO#{a=0;}Initially #CALL{a0}#{a=2;}, but now #CALL{a0}."
code = (
r"#MACRO{a0}#IF{a==0}$a=0$#ELSE$a\neq 0$#END#END_MACRO"
"#{a=0;}Initially #CALL{a0}#{a=2;}, but now #CALL{a0}."
)
assert parse(code) == r"Initially $a=0$, but now $a\neq 0$."


Expand Down

0 comments on commit 37402cb

Please sign in to comment.