Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
rev: "v6.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -13,26 +13,26 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.11.4"
rev: "v0.15.20"
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/psf/black
rev: "25.1.0"
- repo: https://github.com/psf/black-pre-commit-mirror
rev: "26.5.1"
hooks:
- id: black


- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.15.0"
rev: "v2.1.0"
hooks:
- id: mypy
exclude: examples


- repo: https://github.com/codespell-project/codespell
rev: "v2.4.1"
rev: "v2.4.2"
hooks:
- id: codespell

Expand Down
45 changes: 10 additions & 35 deletions pyodide_pack/tests/test_ast_rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@ def foo():
'''
tree = ast.parse(dedent(src_code))
tree = _StripDocstringsTransformer().visit(tree)
assert (
ast.unparse(tree)
== dedent(
"""
assert ast.unparse(tree) == dedent("""
def foo():
return 1"""
).strip("\n")
)
return 1""").strip("\n")


def test_strip_docstrings_nested_functions():
Expand All @@ -41,18 +36,13 @@ def bar():
'''
tree = ast.parse(dedent(src_code))
tree = _StripDocstringsTransformer().visit(tree)
assert (
ast.unparse(tree)
== dedent(
"""
assert ast.unparse(tree) == dedent("""
def foo():

def bar():
return 2
return bar
"""
).strip("\n")
)
""").strip("\n")


def test_strip_docstrings_class():
Expand All @@ -72,20 +62,15 @@ def bar(self):
'''
tree = ast.parse(dedent(src_code))
tree = _StripDocstringsTransformer().visit(tree)
assert (
ast.unparse(tree)
== dedent(
"""
assert ast.unparse(tree) == dedent("""
class A:

def foo(self):
return 2

def bar(self):
return 1
"""
).strip("\n")
)
""").strip("\n")


def test_strip_docstrings_empty_function():
Expand All @@ -95,15 +80,10 @@ def foo():
'''
tree = ast.parse(dedent(src_code))
tree = _StripDocstringsTransformer().visit(tree)
assert (
ast.unparse(tree)
== dedent(
"""
assert ast.unparse(tree) == dedent("""
def foo():
pass
"""
).strip("\n")
)
""").strip("\n")


def test_strip_module_docstrings():
Expand All @@ -113,14 +93,9 @@ def test_strip_module_docstrings():
'''
tree = ast.parse(dedent(src_code))
tree = _strip_module_docstring(tree)
assert (
ast.unparse(tree)
== dedent(
"""
assert ast.unparse(tree) == dedent("""
a = 1
"""
).strip("\n")
)
""").strip("\n")


@settings(deadline=300)
Expand Down
Loading