Skip to content

Commit

Permalink
test: test cases with same and opposite quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyphack committed Jun 11, 2024
1 parent 1b58828 commit 14f51e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,9 @@ def f():
def foo(self, user: AbstractBaseUser["int"], view: "type[CondorBaseViewSet]"):
pass

def foo(self, user: AbstractBaseUser['int']):
pass

def foo(self, user: AbstractBaseUser['int', "str"]):
pass

5 changes: 1 addition & 4 deletions crates/ruff_linter/src/rules/flake8_type_checking/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,7 @@ pub(crate) fn quote_annotation(
let annotation = generator.expr(expr);

let annotation_new = if annotation.contains(quote.as_char()) {
annotation.replace(
quote.as_char(),
&quote.opposite().as_char().to_string(),
)
annotation.replace(quote.as_char(), &quote.opposite().as_char().to_string())
} else {
annotation
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,12 @@ quote.py:102:44: TCH002 [*] Move third-party import `django.contrib.auth.models.
104 |- def foo(self, user: AbstractBaseUser["int"], view: "type[CondorBaseViewSet]"):
107 |+ def foo(self, user: "AbstractBaseUser['int']", view: "type[CondorBaseViewSet]"):
105 108 | pass
106 109 |
106 109 |
107 |- def foo(self, user: AbstractBaseUser['int']):
110 |+ def foo(self, user: "AbstractBaseUser['int']"):
108 111 | pass
109 112 |
110 |- def foo(self, user: AbstractBaseUser['int', "str"]):
113 |+ def foo(self, user: "AbstractBaseUser['int', 'str']"):
111 114 | pass
112 115 |

0 comments on commit 14f51e3

Please sign in to comment.