diff options
author | Marc Mueller <30130371+cdce8p@users.noreply.github.com> | 2021-06-09 23:25:23 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-06-10 12:49:20 +0200 |
commit | 6bf3bd1ca11c8ce366e477d3bb55f74dcc5a4f1a (patch) | |
tree | a0b0b3171e7480b494aeb121e63b060d232230c5 /tests/functional | |
parent | 8ff4d5d6bdb9590677d6a59c070e436ea283a8c6 (diff) | |
download | pylint-git-6bf3bd1ca11c8ce366e477d3bb55f74dcc5a4f1a.tar.gz |
Revert "Fix existing tests"
Diffstat (limited to 'tests/functional')
12 files changed, 43 insertions, 43 deletions
diff --git a/tests/functional/b/bad_indentation.py b/tests/functional/b/bad_indentation.py index c5214899d..4c50eae0b 100644 --- a/tests/functional/b/bad_indentation.py +++ b/tests/functional/b/bad_indentation.py @@ -12,7 +12,7 @@ def titii(): 1 # and this. # [bad-indentation] def tataa(kdict): - for key in ('1', '2', '3'): + for key in ['1', '2', '3']: key = key.lower() if key in kdict: diff --git a/tests/functional/c/consider/consider_join.py b/tests/functional/c/consider/consider_join.py index 0e17edbab..24cd6dd49 100644 --- a/tests/functional/c/consider/consider_join.py +++ b/tests/functional/c/consider/consider_join.py @@ -2,59 +2,59 @@ # Variations of 'result' result = '' -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += number # [consider-using-join] result = 'header' -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += number # [consider-using-join] result = another_result = '' -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += number # [consider-using-join] another_result = result = '' -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += number # [consider-using-join] result = 0 # result is not a string -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += number RESULT = '' # wrong name / initial variable missing -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += [number] string_variable = '' result = string_variable # type of 'result' not obviously a string -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += number result = '' another_result = '' # result defined too early -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += [number] -for number in ('1', '2', '3'): # 'result'-definition missing +for number in ['1', '2', '3']: # 'result'-definition missing result += number # Variations of 'number' result = '' # no concatenation (iterator-name differs) -for name in ('1', '2', '3'): +for name in ['1', '2', '3']: result += number result = '' # no concatenation (iterator-name differs) -for _ in ('1', '2', '3'): +for _ in ['1', '2', '3']: result += number # 'exprlist' is not a single name -for index, number in ('1', '2', '3'): +for index, number in ['1', '2', '3']: result += number # Variations of 'iterable' result = '' -for number in (): +for number in []: result += number # [consider-using-join] result = '' @@ -62,7 +62,7 @@ for number in "a text": result += number # [consider-using-join] result = '' -for number in (1, 2, 3): +for number in [1, 2, 3]: result += number # [consider-using-join] a_list = [1, 2, 3] @@ -71,7 +71,7 @@ for number in a_list: result += number # [consider-using-join] result = '' -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += number # [consider-using-join] result = '' @@ -81,46 +81,46 @@ for number in undefined_iterable: # Variations of loop-body result = '' # addition is not the only part of the body -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: print(number) result += number result = '' # addition is not the only part of the body -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += number print(number) result = '' # augmented addition is not a simple one -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += '4' + number result = '' # assignment is not augmented -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result = number result = '' # augmented assignment is not an addition -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result -= number result = '' # addition is not the 'number'-iterable -for number in ('1', '2', '3'): +for number in ['1', '2', '3']: result += another_number result = '' -for number in ('1', '2', '3'): result += number # [consider-using-join] +for number in ['1', '2', '3']: result += number # [consider-using-join] result = '' -for number in ('1',): +for number in ['1']: result.result += number # Does not emit if the body is more complex result = {'context': 1} result['context'] = 0 -for number in ('1',): +for number in ['1']: result1 = 42 + int(number) result['context'] += result1 * 24 # Does not crash if the previous sibling does not have AssignNames result['context'] = 0 -for number in ('1',): +for number in ['1']: result['context'] += 24 diff --git a/tests/functional/c/consider/consider_using_dict_comprehension.py b/tests/functional/c/consider/consider_using_dict_comprehension.py index 9c6145d61..da0be6d5a 100644 --- a/tests/functional/c/consider/consider_using_dict_comprehension.py +++ b/tests/functional/c/consider/consider_using_dict_comprehension.py @@ -9,4 +9,4 @@ dict([]) dict([(number, number*2) for number in numbers]) # [consider-using-dict-comprehension]
# Cannot emit as this cannot be written as a comprehension
-dict([value.split("=") for value in ("a=b", "c=d")])
+dict([value.split("=") for value in ["a=b", "c=d"]])
diff --git a/tests/functional/l/len_checks.py b/tests/functional/l/len_checks.py index 9305ee2c3..2cbefcbe7 100644 --- a/tests/functional/l/len_checks.py +++ b/tests/functional/l/len_checks.py @@ -124,8 +124,8 @@ def github_issue_1879(): assert len(ClassWithoutBool()) # [len-as-condition] assert len(ChildClassWithoutBool()) # [len-as-condition] assert len(range(0)) # [len-as-condition] - assert len([t + 1 for t in ()]) # [len-as-condition] - assert len(u + 1 for u in ()) # [len-as-condition] + assert len([t + 1 for t in []]) # [len-as-condition] + assert len(u + 1 for u in []) # [len-as-condition] assert len({"1":(v + 1) for v in {}}) # [len-as-condition] assert len(set((w + 1) for w in set())) # [len-as-condition] diff --git a/tests/functional/r/recursion/recursion_error_crash_2683.py b/tests/functional/r/recursion/recursion_error_crash_2683.py index 06c5fd711..05978a355 100644 --- a/tests/functional/r/recursion/recursion_error_crash_2683.py +++ b/tests/functional/r/recursion/recursion_error_crash_2683.py @@ -7,7 +7,7 @@ class Cls: def method(self): records = [] - for _ in (): + for _ in []: records += [] records = records[:self.count] records.sort() diff --git a/tests/functional/r/redefined_argument_from_local.py b/tests/functional/r/redefined_argument_from_local.py index d2b0c6946..b1735e9c0 100644 --- a/tests/functional/r/redefined_argument_from_local.py +++ b/tests/functional/r/redefined_argument_from_local.py @@ -21,24 +21,24 @@ def test_not_redefined_in_with(name): def test_redefined_in_for(name): - for name in (): # [redefined-argument-from-local] + for name in []: # [redefined-argument-from-local] pass - for (name, is_) in (): # [redefined-argument-from-local] + for (name, is_) in []: # [redefined-argument-from-local] pass - for (is_, (name, _)) in (): # [redefined-argument-from-local] + for (is_, (name, _)) in []: # [redefined-argument-from-local] pass - for _ in (): + for _ in []: pass def test_not_redefined_in_for(name): - for name_1 in (): + for name_1 in []: pass # This one can be okay if you are interested in the last value # of the iteration other = None - for other in (): + for other in []: pass diff --git a/tests/functional/r/reused_outer_loop_variable.py b/tests/functional/r/reused_outer_loop_variable.py index aa3a3fb6b..b244e99f5 100644 --- a/tests/functional/r/reused_outer_loop_variable.py +++ b/tests/functional/r/reused_outer_loop_variable.py @@ -18,7 +18,7 @@ for i in range(10): print(i, i_again) # With nested tuple unpacks -for (a, (b, c)) in ((1, (2, 3)),): +for (a, (b, c)) in [(1, (2, 3))]: for i, a in range(10): #[redefined-outer-name] print(i, a, b, c) diff --git a/tests/functional/r/reused_outer_loop_variable_py3.py b/tests/functional/r/reused_outer_loop_variable_py3.py index 44e3ea28f..6eaa1f51c 100644 --- a/tests/functional/r/reused_outer_loop_variable_py3.py +++ b/tests/functional/r/reused_outer_loop_variable_py3.py @@ -1,5 +1,5 @@ """Python >= 3 tests for redefining an outer loop's variable.""" -for i, *j in ((1, 2, 3, 4),): +for i, *j in [(1, 2, 3, 4)]: for j in range(i): #[redefined-outer-name] print(j) diff --git a/tests/functional/u/undefined/undefined_loop_variable.py b/tests/functional/u/undefined/undefined_loop_variable.py index 3df043dbe..a984898f8 100644 --- a/tests/functional/u/undefined/undefined_loop_variable.py +++ b/tests/functional/u/undefined/undefined_loop_variable.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring,redefined-builtin,consider-using-tuple +# pylint: disable=missing-docstring,redefined-builtin def do_stuff(some_random_list): for var in some_random_list: diff --git a/tests/functional/u/undefined/undefined_variable.py b/tests/functional/u/undefined/undefined_variable.py index 3e8e6514d..7fe205cc9 100644 --- a/tests/functional/u/undefined/undefined_variable.py +++ b/tests/functional/u/undefined/undefined_variable.py @@ -212,7 +212,7 @@ class LambdaClass: class LambdaClass2: myattr = 1 # Different base_scope scope but still applies - mylambda2 = lambda: [LambdaClass2.myattr for _ in (1, 2)] + mylambda2 = lambda: [LambdaClass2.myattr for _ in [1, 2]] class LambdaClass3: myattr = 1 @@ -291,6 +291,6 @@ class DunderClass: def undefined_annotation(a:x): # [undefined-variable] if x == 2: # [used-before-assignment] - for x in (1, 2): + for x in [1, 2]: pass return a diff --git a/tests/functional/u/unused/unused_typing_imports.py b/tests/functional/u/unused/unused_typing_imports.py index 5e6a891c6..7de4e411b 100644 --- a/tests/functional/u/unused/unused_typing_imports.py +++ b/tests/functional/u/unused/unused_typing_imports.py @@ -33,7 +33,7 @@ def func2(*, arg: Optional[Iterable]=None): SOME_VALUE = [1] # type: List[Any] -for VALUE in ([1], [2], [3]): # type: Tuple[Any] +for VALUE in [[1], [2], [3]]: # type: Tuple[Any] print(VALUE) diff --git a/tests/functional/u/use/used_before_assignment_issue1081.py b/tests/functional/u/use/used_before_assignment_issue1081.py index 3987dbeda..0c59ccebe 100644 --- a/tests/functional/u/use/used_before_assignment_issue1081.py +++ b/tests/functional/u/use/used_before_assignment_issue1081.py @@ -5,7 +5,7 @@ x = 24 def used_before_assignment_1(a): if x == a: # [used-before-assignment] - for x in (1, 2): # [redefined-outer-name] + for x in [1, 2]: # [redefined-outer-name] pass |