diff --git a/README.md b/README.md index f415786c..0b32ac41 100644 --- a/README.md +++ b/README.md @@ -780,7 +780,6 @@ Availability: Availability: - File imports `from __future__ import annotations` -- `--py311-plus` is passed on the commandline. ```diff -def f(x: 'queue.Queue[int]') -> C: diff --git a/pyupgrade/_plugins/typing_pep563.py b/pyupgrade/_plugins/typing_pep563.py index e8e75c45..a8ca162f 100644 --- a/pyupgrade/_plugins/typing_pep563.py +++ b/pyupgrade/_plugins/typing_pep563.py @@ -16,10 +16,7 @@ def _supported_version(state: State) -> bool: - return ( - state.settings.min_version >= (3, 11) or - 'annotations' in state.from_imports['__future__'] - ) + return 'annotations' in state.from_imports['__future__'] def _dequote(i: int, tokens: list[Token], *, new: str) -> None: diff --git a/tests/features/typing_pep563_test.py b/tests/features/typing_pep563_test.py index ccad52d2..fecd6a54 100644 --- a/tests/features/typing_pep563_test.py +++ b/tests/features/typing_pep563_test.py @@ -15,7 +15,7 @@ 'from typing import Literal\n' 'x: "str"\n', (2, 7), - id='not python 3.11+', + id='missing __future__ import', ), pytest.param( 'from __future__ import annotations\n' @@ -354,11 +354,6 @@ def test_fix_typing_pep563(s, expected): assert ret == expected -def test_replaced_for_minimum_version(): - ret = _fix_plugins('x: "int"', settings=Settings(min_version=(3, 11))) - assert ret == 'x: int' - - @pytest.mark.xfail( sys.version_info < (3, 8), reason='posonly args not available in Python3.7',