Skip to content

Commit

Permalink
Merge pull request #139 from asottile/312_syntax
Browse files Browse the repository at this point in the history
fix tests for python 3.12
  • Loading branch information
asottile committed Jun 10, 2023
2 parents be01ce6 + 3a67f63 commit 2b12235
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
main:
uses: asottile/workflows/.github/workflows/tox.yml@v1.0.0
with:
env: '["py38", "py39", "py310"]'
env: '["py38", "py39", "py310", "py311", "py312"]'
23 changes: 22 additions & 1 deletion tests/astpretty_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,26 @@ def f(


def test_pformat_py38_type_comments(tmpdir, capsys):
expected = '''\
expected_38 = '''\
Module(
body=[
FunctionDef(
lineno=1,
col_offset=0,
end_lineno=2,
end_col_offset=8,
name='f',
args=arguments(posonlyargs=[], args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]),
body=[Pass(lineno=2, col_offset=4, end_lineno=2, end_col_offset=8)],
decorator_list=[],
returns=None,
type_comment='() -> None',
),
],
type_ignores=[TypeIgnore(lineno=2, tag='')],
)
''' # noqa: E501
expected_312 = '''\
Module(
body=[
FunctionDef(
Expand All @@ -316,11 +335,13 @@ def test_pformat_py38_type_comments(tmpdir, capsys):
decorator_list=[],
returns=None,
type_comment='() -> None',
type_params=[],
),
],
type_ignores=[TypeIgnore(lineno=2, tag='')],
)
''' # noqa: E501
expected = expected_312 if sys.version_info >= (3, 12) else expected_38
mod = (
'def f(): # type: () -> None\n'
' pass # type: ignore\n'
Expand Down

0 comments on commit 2b12235

Please sign in to comment.