diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 0526d16..5b4ebf6 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -29,7 +29,7 @@ jobs: timeout-minutes: 5 strategy: matrix: - python-version: ["3.10", "3.14"] + python-version: ["3.10", "3.15"] fail-fast: false steps: - uses: actions/checkout@v6 @@ -54,7 +54,7 @@ jobs: strategy: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"] fail-fast: false steps: - uses: actions/checkout@v6 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5460aa9..321e982 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ flake8-pyi uses Calendar Versioning (CalVer). ## Unreleased +### Other changes + +* Support Python 3.15. + ## 26.5.0 ### Breaking Changes diff --git a/flake8_pyi/visitor.py b/flake8_pyi/visitor.py index 5e1fca7..4bb8d53 100644 --- a/flake8_pyi/visitor.py +++ b/flake8_pyi/visitor.py @@ -325,10 +325,10 @@ def _analyse_exit_method_arg(node: ast.BinOp) -> ExitArgAnalysis: >>> _analyse_exit_method_arg(_ast_node_for('int | str')) ExitArgAnalysis(is_union_with_None=False, non_None_part=None) - >>> _analyse_exit_method_arg(_ast_node_for('int | None')) - ExitArgAnalysis(is_union_with_None=True, non_None_part=Name(id='int', ctx=Load())) - >>> _analyse_exit_method_arg(_ast_node_for('None | str')) - ExitArgAnalysis(is_union_with_None=True, non_None_part=Name(id='str', ctx=Load())) + >>> _analyse_exit_method_arg(_ast_node_for('int | None')) # doctest: +ELLIPSIS + ExitArgAnalysis(is_union_with_None=True, non_None_part=Name(id='int'...)) + >>> _analyse_exit_method_arg(_ast_node_for('None | str')) # doctest: +ELLIPSIS + ExitArgAnalysis(is_union_with_None=True, non_None_part=Name(id='str'...)) """ assert isinstance(node.op, ast.BitOr) if _is_None(node.left): @@ -479,7 +479,8 @@ def _analyse_union(members: Sequence[ast.expr]) -> UnionAnalysis: >>> source = 'Union[int, memoryview, memoryview, Literal["foo"], Literal[1], type[float], type[str]]' >>> union = _ast_node_for(source) >>> analysis = _analyse_union(union.slice.elts) - >>> len(analysis.members_by_dump["Name(id='memoryview', ctx=Load())"]) + >>> dump = "Name(id='memoryview')" if sys.version_info >= (3, 15) else "Name(id='memoryview', ctx=Load())" + >>> len(analysis.members_by_dump[dump]) 2 >>> analysis.dupes_in_union True