diff options
author | Paul Lichtenberger <paul.lichtenberger.rgbg@gmail.com> | 2022-06-11 19:05:48 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-06-15 08:43:02 +0200 |
commit | c742f8fbf45a1201774c92c404e2707907547cb1 (patch) | |
tree | 08312785bf44f7964879f8d1dd0621ab87ed6e31 /tests | |
parent | e9683c465364005459bd2b4a9d06b8d82c358eb8 (diff) | |
download | pylint-git-c742f8fbf45a1201774c92c404e2707907547cb1.tar.gz |
Fixed misinterpreted modulo sign for ``consider-using-f-string`` (#6914)
* Fixed a false positive in consider-using-f-string if the left side of a % is not a string.
* consider-using-f-string: if left side of a \% does not have the attr value it can't be a str
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/c/consider/consider_using_f_string.py | 3 | ||||
-rw-r--r-- | tests/functional/c/consider/consider_using_f_string.txt | 36 |
2 files changed, 21 insertions, 18 deletions
diff --git a/tests/functional/c/consider/consider_using_f_string.py b/tests/functional/c/consider/consider_using_f_string.py index f6801989e..e961c44f7 100644 --- a/tests/functional/c/consider/consider_using_f_string.py +++ b/tests/functional/c/consider/consider_using_f_string.py @@ -72,6 +72,9 @@ def statement_good(): "{}".format("\n".join(i for i in "string")) "%s" % "\n" "%s" % "\n".join(i for i in "string") + 1 % "str" + (1, 2) % 'garbage' + def statement_bad(): "String %f" % PARAM_1 # [consider-using-f-string] diff --git a/tests/functional/c/consider/consider_using_f_string.txt b/tests/functional/c/consider/consider_using_f_string.txt index f3ac4adf0..1d68e947b 100644 --- a/tests/functional/c/consider/consider_using_f_string.txt +++ b/tests/functional/c/consider/consider_using_f_string.txt @@ -8,23 +8,23 @@ consider-using-f-string:51:10:51:21:print_bad:Formatting a regular string which consider-using-f-string:52:10:52:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED consider-using-f-string:53:10:53:24:print_bad:Formatting a regular string which could be a f-string:UNDEFINED consider-using-f-string:54:10:54:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:77:4:77:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:78:4:78:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:79:4:79:22:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:80:4:80:11:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:81:4:81:20:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:82:4:82:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:83:4:83:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:84:4:84:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:85:4:85:18:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:80:4:80:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:81:4:81:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:82:4:82:22:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:83:4:83:11:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:84:4:84:20:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:85:4:85:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED consider-using-f-string:86:4:86:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:109:8:109:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:110:8:110:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:111:8:111:26:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:112:8:112:15:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:113:8:113:24:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:114:8:114:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:115:8:115:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:116:8:116:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:117:8:117:22:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:87:4:87:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:88:4:88:18:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:89:4:89:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:112:8:112:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:113:8:113:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:114:8:114:26:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:115:8:115:15:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:116:8:116:24:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:117:8:117:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED consider-using-f-string:118:8:118:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:119:8:119:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:120:8:120:22:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:121:8:121:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED |