File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -5654,3 +5654,34 @@ fn semantic_syntax_errors() -> Result<()> {
56545654
56555655 Ok ( ( ) )
56565656}
5657+
5658+ /// Regression test for <https://github.com/astral-sh/ruff/issues/17821>.
5659+ ///
5660+ /// `lint.typing-extensions = false` with Python 3.9 should disable the PYI019 lint because it would
5661+ /// try to import `Self` from `typing_extensions`
5662+ #[ test]
5663+ fn combine_typing_extensions_config ( ) {
5664+ let contents = "
5665+ from typing import TypeVar
5666+ T = TypeVar('T')
5667+ class Foo:
5668+ def f(self: T) -> T: ...
5669+ " ;
5670+ assert_cmd_snapshot ! (
5671+ Command :: new( get_cargo_bin( BIN_NAME ) )
5672+ . args( STDIN_BASE_OPTIONS )
5673+ . args( [ "--config" , "lint.typing-extensions = false" ] )
5674+ . arg( "--select=PYI019" )
5675+ . arg( "--target-version=py39" )
5676+ . arg( "-" )
5677+ . pass_stdin( contents) ,
5678+ @r"
5679+ success: true
5680+ exit_code: 0
5681+ ----- stdout -----
5682+ All checks passed!
5683+
5684+ ----- stderr -----
5685+ "
5686+ ) ;
5687+ }
Original file line number Diff line number Diff line change @@ -1172,7 +1172,7 @@ impl LintConfiguration {
11721172 pylint : self . pylint . combine ( config. pylint ) ,
11731173 pyupgrade : self . pyupgrade . combine ( config. pyupgrade ) ,
11741174 ruff : self . ruff . combine ( config. ruff ) ,
1175- typing_extensions : self . typing_extensions ,
1175+ typing_extensions : self . typing_extensions . or ( config . typing_extensions ) ,
11761176 }
11771177 }
11781178}
You can’t perform that action at this time.
0 commit comments