summaryrefslogtreecommitdiff
path: root/tests/functional/u
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/u')
-rw-r--r--tests/functional/u/unbalanced/unbalanced_dict_unpacking.py (renamed from tests/functional/u/unbalanced_dict_unpacking.py)0
-rw-r--r--tests/functional/u/unbalanced/unbalanced_dict_unpacking.txt (renamed from tests/functional/u/unbalanced_dict_unpacking.txt)0
-rw-r--r--tests/functional/u/unbalanced/unbalanced_tuple_unpacking.py (renamed from tests/functional/u/unbalanced_tuple_unpacking.py)2
-rw-r--r--tests/functional/u/unbalanced/unbalanced_tuple_unpacking.txt (renamed from tests/functional/u/unbalanced_tuple_unpacking.txt)0
-rw-r--r--tests/functional/u/unbalanced/unbalanced_tuple_unpacking_py30.py (renamed from tests/functional/u/unbalanced_tuple_unpacking_py30.py)0
-rw-r--r--tests/functional/u/undefined/undefined_loop_variable.py17
-rw-r--r--tests/functional/u/undefined/undefined_loop_variable.txt8
-rw-r--r--tests/functional/u/undefined/undefined_loop_variable_py38.py2
-rw-r--r--tests/functional/u/undefined/undefined_variable.py4
-rw-r--r--tests/functional/u/undefined/undefined_variable.txt2
-rw-r--r--tests/functional/u/undefined/undefined_variable_classes.py4
-rw-r--r--tests/functional/u/undefined/undefined_variable_decorators.py2
-rw-r--r--tests/functional/u/undefined/undefined_variable_py30.py4
-rw-r--r--tests/functional/u/undefined/undefined_variable_py38.py6
-rw-r--r--tests/functional/u/undefined/undefined_variable_typing.py6
-rw-r--r--tests/functional/u/unexpected_special_method_signature.py2
-rw-r--r--tests/functional/u/ungrouped_imports.py2
-rw-r--r--tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py12
-rw-r--r--tests/functional/u/unnecessary/unnecessary_ellipsis.py2
-rw-r--r--tests/functional/u/unnecessary/unnecessary_list_index_lookup.py12
-rw-r--r--tests/functional/u/unpacking/unpacking_non_sequence_py37.py4
-rw-r--r--tests/functional/u/unreachable.py2
-rw-r--r--tests/functional/u/unspecified_encoding_py38.py10
-rw-r--r--tests/functional/u/unsubscriptable_object.py2
-rw-r--r--tests/functional/u/unused/unused_argument.py2
-rw-r--r--tests/functional/u/unused/unused_import.py2
-rw-r--r--tests/functional/u/unused/unused_import_class_def_keyword.py2
-rw-r--r--tests/functional/u/unused/unused_import_everything_disabled.py4
-rw-r--r--tests/functional/u/unused/unused_import_positional_only_py38.py2
-rw-r--r--tests/functional/u/unused/unused_private_member.py20
-rw-r--r--tests/functional/u/unused/unused_typing_imports.py2
-rw-r--r--tests/functional/u/unused/unused_variable.py2
-rw-r--r--tests/functional/u/unused/unused_variable_after_inference.py2
-rw-r--r--tests/functional/u/use/use_a_generator.py2
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison.py6
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison.txt64
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py22
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc2
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt6
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py46
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc2
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt6
-rw-r--r--tests/functional/u/use/use_implicit_booleaness_not_len.py24
-rw-r--r--tests/functional/u/use/use_maxsplit_arg.py4
-rw-r--r--tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py2
-rw-r--r--tests/functional/u/used/used_before_assignment.py62
-rw-r--r--tests/functional/u/used/used_before_assignment.txt14
-rw-r--r--tests/functional/u/used/used_before_assignment_class_nested_under_function.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_comprehension_homonyms.py6
-rw-r--r--tests/functional/u/used/used_before_assignment_else_return.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_issue2615.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_issue4761.py4
-rw-r--r--tests/functional/u/used/used_before_assignment_issue85.py4
-rw-r--r--tests/functional/u/used/used_before_assignment_nonlocal.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_postponed_evaluation.py13
-rw-r--r--tests/functional/u/used/used_before_assignment_postponed_evaluation.txt1
-rw-r--r--tests/functional/u/used/used_before_assignment_py37.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_scoping.py18
-rw-r--r--tests/functional/u/used/used_before_assignment_scoping.txt2
-rw-r--r--tests/functional/u/used/used_before_assignment_ternary.txt6
-rw-r--r--tests/functional/u/used/used_before_assignment_type_annotations.py2
-rw-r--r--tests/functional/u/used/used_before_assignment_typing.py13
-rw-r--r--tests/functional/u/used/used_before_assignment_typing.txt10
-rw-r--r--tests/functional/u/useless/useless_parent_delegation.py2
-rw-r--r--tests/functional/u/useless/useless_suppression.py6
66 files changed, 340 insertions, 164 deletions
diff --git a/tests/functional/u/unbalanced_dict_unpacking.py b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.py
index 2c4d3b103..2c4d3b103 100644
--- a/tests/functional/u/unbalanced_dict_unpacking.py
+++ b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.py
diff --git a/tests/functional/u/unbalanced_dict_unpacking.txt b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.txt
index b31d89b40..b31d89b40 100644
--- a/tests/functional/u/unbalanced_dict_unpacking.txt
+++ b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.txt
diff --git a/tests/functional/u/unbalanced_tuple_unpacking.py b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.py
index 226748933..21e497be8 100644
--- a/tests/functional/u/unbalanced_tuple_unpacking.py
+++ b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.py
@@ -158,5 +158,5 @@ a, b = my_function("12") # [unbalanced-tuple-unpacking]
c = my_function("12")
d, *_ = my_function("12")
-# https://github.com/PyCQA/pylint/issues/5998
+# https://github.com/pylint-dev/pylint/issues/5998
x, y, z = (1, 2) # [unbalanced-tuple-unpacking]
diff --git a/tests/functional/u/unbalanced_tuple_unpacking.txt b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.txt
index 651e09840..651e09840 100644
--- a/tests/functional/u/unbalanced_tuple_unpacking.txt
+++ b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.txt
diff --git a/tests/functional/u/unbalanced_tuple_unpacking_py30.py b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking_py30.py
index c45cccdd1..c45cccdd1 100644
--- a/tests/functional/u/unbalanced_tuple_unpacking_py30.py
+++ b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking_py30.py
diff --git a/tests/functional/u/undefined/undefined_loop_variable.py b/tests/functional/u/undefined/undefined_loop_variable.py
index 9d5cf4111..10d6dc60b 100644
--- a/tests/functional/u/undefined/undefined_loop_variable.py
+++ b/tests/functional/u/undefined/undefined_loop_variable.py
@@ -1,11 +1,6 @@
# pylint: disable=missing-docstring,redefined-builtin, consider-using-f-string, unnecessary-direct-lambda-call, broad-exception-raised
-import sys
-
-if sys.version_info >= (3, 8):
- from typing import NoReturn
-else:
- from typing_extensions import NoReturn
+from typing import NoReturn
def do_stuff(some_random_list):
@@ -84,7 +79,7 @@ def do_stuff_with_redefined_range():
def test(content):
- # https://github.com/PyCQA/pylint/issues/3711
+ # https://github.com/pylint-dev/pylint/issues/3711
def handle_line(layne):
if "X" in layne:
layne = layne.replace("X", "Y")
@@ -160,7 +155,7 @@ bigger = [
def lambda_in_first_of_two_loops():
- """https://github.com/PyCQA/pylint/issues/6419"""
+ """https://github.com/pylint-dev/pylint/issues/6419"""
my_list = []
for thing in my_list:
print_it = lambda: print(thing) # pylint: disable=cell-var-from-loop, unnecessary-lambda-assignment
@@ -180,21 +175,21 @@ def variable_name_assigned_in_body_of_second_loop():
def use_enumerate():
- """https://github.com/PyCQA/pylint/issues/6593"""
+ """https://github.com/pylint-dev/pylint/issues/6593"""
for i, num in enumerate(range(3)):
pass
print(i, num)
def use_enumerate_in_ternary_expression():
- """https://github.com/PyCQA/pylint/issues/7131"""
+ """https://github.com/pylint-dev/pylint/issues/7131"""
for i, num in enumerate(range(3)) if __revision__ else enumerate(range(4)):
pass
print(i, num)
def find_even_number(container):
- """https://github.com/PyCQA/pylint/pull/6923#discussion_r895134495"""
+ """https://github.com/pylint-dev/pylint/pull/6923#discussion_r895134495"""
for something in container:
if something % 2 == 0:
break
diff --git a/tests/functional/u/undefined/undefined_loop_variable.txt b/tests/functional/u/undefined/undefined_loop_variable.txt
index e10c9e002..78dc602ed 100644
--- a/tests/functional/u/undefined/undefined_loop_variable.txt
+++ b/tests/functional/u/undefined/undefined_loop_variable.txt
@@ -1,4 +1,4 @@
-undefined-loop-variable:14:11:14:14:do_stuff:Using possibly undefined loop variable 'var':UNDEFINED
-undefined-loop-variable:33:7:33:11::Using possibly undefined loop variable 'var1':UNDEFINED
-undefined-loop-variable:83:11:83:14:do_stuff_with_redefined_range:Using possibly undefined loop variable 'var':UNDEFINED
-undefined-loop-variable:201:11:201:20:find_even_number:Using possibly undefined loop variable 'something':UNDEFINED
+undefined-loop-variable:9:11:9:14:do_stuff:Using possibly undefined loop variable 'var':UNDEFINED
+undefined-loop-variable:28:7:28:11::Using possibly undefined loop variable 'var1':UNDEFINED
+undefined-loop-variable:78:11:78:14:do_stuff_with_redefined_range:Using possibly undefined loop variable 'var':UNDEFINED
+undefined-loop-variable:196:11:196:20:find_even_number:Using possibly undefined loop variable 'something':UNDEFINED
diff --git a/tests/functional/u/undefined/undefined_loop_variable_py38.py b/tests/functional/u/undefined/undefined_loop_variable_py38.py
index 5778df7d2..f9bd06f62 100644
--- a/tests/functional/u/undefined/undefined_loop_variable_py38.py
+++ b/tests/functional/u/undefined/undefined_loop_variable_py38.py
@@ -2,7 +2,7 @@
def walrus_in_comprehension_test(container):
- """https://github.com/PyCQA/pylint/issues/7222"""
+ """https://github.com/pylint-dev/pylint/issues/7222"""
for something in container:
print(something)
print([my_test for something in container if (my_test := something)])
diff --git a/tests/functional/u/undefined/undefined_variable.py b/tests/functional/u/undefined/undefined_variable.py
index 78a32dacc..e1b66910f 100644
--- a/tests/functional/u/undefined/undefined_variable.py
+++ b/tests/functional/u/undefined/undefined_variable.py
@@ -203,7 +203,7 @@ def dec(inp):
# referencing parent class do not raise undefined variable
# because at the time of their calling, the class name will
# be populated
-# See https://github.com/PyCQA/pylint/issues/704
+# See https://github.com/pylint-dev/pylint/issues/704
class LambdaClass:
myattr = 1
mylambda = lambda: LambdaClass.myattr
@@ -346,7 +346,7 @@ def decorated4(x):
print(x)
-# https://github.com/PyCQA/pylint/issues/5111
+# https://github.com/pylint-dev/pylint/issues/5111
# AssignAttr in orelse block of 'TYPE_CHECKING' shouldn't crash
# Name being assigned must be imported in orelse block
if TYPE_CHECKING:
diff --git a/tests/functional/u/undefined/undefined_variable.txt b/tests/functional/u/undefined/undefined_variable.txt
index ab1a00420..b41f9ae46 100644
--- a/tests/functional/u/undefined/undefined_variable.txt
+++ b/tests/functional/u/undefined/undefined_variable.txt
@@ -27,7 +27,7 @@ undefined-variable:166:4:166:13::Undefined variable 'unicode_2':UNDEFINED
undefined-variable:171:4:171:13::Undefined variable 'unicode_3':UNDEFINED
undefined-variable:226:25:226:37:LambdaClass4.<lambda>:Undefined variable 'LambdaClass4':UNDEFINED
undefined-variable:234:25:234:37:LambdaClass5.<lambda>:Undefined variable 'LambdaClass5':UNDEFINED
-used-before-assignment:255:26:255:34:func_should_fail:Using variable 'datetime' before assignment:HIGH
+used-before-assignment:255:26:255:34:func_should_fail:Using variable 'datetime' before assignment:CONTROL_FLOW
undefined-variable:291:18:291:24:not_using_loop_variable_accordingly:Undefined variable 'iteree':UNDEFINED
undefined-variable:308:27:308:28:undefined_annotation:Undefined variable 'x':UNDEFINED
used-before-assignment:309:7:309:8:undefined_annotation:Using variable 'x' before assignment:HIGH
diff --git a/tests/functional/u/undefined/undefined_variable_classes.py b/tests/functional/u/undefined/undefined_variable_classes.py
index 364e24942..64d0007a5 100644
--- a/tests/functional/u/undefined/undefined_variable_classes.py
+++ b/tests/functional/u/undefined/undefined_variable_classes.py
@@ -2,7 +2,7 @@
# pylint: disable=missing-function-docstring, missing-class-docstring, too-few-public-methods
# Test that list comprehensions in base classes are scoped correctly
-# Regression reported in https://github.com/PyCQA/pylint/issues/3434
+# Regression reported in https://github.com/pylint-dev/pylint/issues/3434
import collections
@@ -14,7 +14,7 @@ class Foo(collections.namedtuple("Foo", [x + "_foo" for x in l])):
# Test that class attributes are in scope for return type annotations.
-# Regression reported in https://github.com/PyCQA/pylint/issues/1976
+# Regression reported in https://github.com/pylint-dev/pylint/issues/1976
class MyObject:
class MyType:
pass
diff --git a/tests/functional/u/undefined/undefined_variable_decorators.py b/tests/functional/u/undefined/undefined_variable_decorators.py
index 359737289..77c0b1229 100644
--- a/tests/functional/u/undefined/undefined_variable_decorators.py
+++ b/tests/functional/u/undefined/undefined_variable_decorators.py
@@ -3,7 +3,7 @@
# pylint: disable=unnecessary-comprehension
# Test that class attributes are in scope for listcomp in decorator.
-# Regression reported in https://github.com/PyCQA/pylint/issues/511
+# Regression reported in https://github.com/pylint-dev/pylint/issues/511
def dec(inp):
def inner(func):
diff --git a/tests/functional/u/undefined/undefined_variable_py30.py b/tests/functional/u/undefined/undefined_variable_py30.py
index ff77aaf8e..723e275a0 100644
--- a/tests/functional/u/undefined/undefined_variable_py30.py
+++ b/tests/functional/u/undefined/undefined_variable_py30.py
@@ -87,7 +87,7 @@ def used_before_assignment(*, arg): return arg + 1
# Test for #4021
-# https://github.com/PyCQA/pylint/issues/4021
+# https://github.com/pylint-dev/pylint/issues/4021
class MetaClass(type):
def __new__(mcs, *args, parameter=None, **kwargs):
print(parameter)
@@ -99,7 +99,7 @@ class InheritingClass(metaclass=MetaClass, parameter=variable): # [undefined-va
# Test for #4031
-# https://github.com/PyCQA/pylint/issues/4031
+# https://github.com/pylint-dev/pylint/issues/4031
class Inheritor(metaclass=DefinedTooLate ): # [undefined-variable]
pass
diff --git a/tests/functional/u/undefined/undefined_variable_py38.py b/tests/functional/u/undefined/undefined_variable_py38.py
index 6fb543e80..1f69a18a8 100644
--- a/tests/functional/u/undefined/undefined_variable_py38.py
+++ b/tests/functional/u/undefined/undefined_variable_py38.py
@@ -120,7 +120,7 @@ sorted_things = sorted(
# Tests for type annotation reused in comprehension
def type_annotation_used_after_comprehension():
- """https://github.com/PyCQA/pylint/issues/5326#issuecomment-982635371"""
+ """https://github.com/pylint-dev/pylint/issues/5326#issuecomment-982635371"""
my_int: int
ints = [my_int + 1 for my_int in range(5)]
@@ -129,13 +129,13 @@ def type_annotation_used_after_comprehension():
def type_annotation_unused_after_comprehension():
- """https://github.com/PyCQA/pylint/issues/5326"""
+ """https://github.com/pylint-dev/pylint/issues/5326"""
my_int: int
_ = [print(sep=my_int, end=my_int) for my_int in range(10)]
def type_annotation_used_improperly_after_comprehension():
- """https://github.com/PyCQA/pylint/issues/5654"""
+ """https://github.com/pylint-dev/pylint/issues/5654"""
my_int: int
_ = [print(sep=my_int, end=my_int) for my_int in range(10)]
print(my_int) # [used-before-assignment]
diff --git a/tests/functional/u/undefined/undefined_variable_typing.py b/tests/functional/u/undefined/undefined_variable_typing.py
index 7ef4d8599..fda65ceca 100644
--- a/tests/functional/u/undefined/undefined_variable_typing.py
+++ b/tests/functional/u/undefined/undefined_variable_typing.py
@@ -2,7 +2,7 @@
# pylint: disable=invalid-name, import-error
# Ensure attribute lookups in type comments are accounted for.
-# Reported in https://github.com/PyCQA/pylint/issues/4603
+# Reported in https://github.com/pylint-dev/pylint/issues/4603
from typing import TYPE_CHECKING, Any, Dict
@@ -16,12 +16,12 @@ c = ... # type: Bar.Boo
if TYPE_CHECKING:
__additional_builtin__: Dict[str, Any]
- # For why this would emit redefined-builtin: https://github.com/PyCQA/pylint/pull/3643
+ # For why this would emit redefined-builtin: https://github.com/pylint-dev/pylint/pull/3643
# pylint: disable-next=redefined-builtin
repr: Any
def run():
- """https://github.com/PyCQA/pylint/issues/6388"""
+ """https://github.com/pylint-dev/pylint/issues/6388"""
print(repr)
return __additional_builtin__["test"]
diff --git a/tests/functional/u/unexpected_special_method_signature.py b/tests/functional/u/unexpected_special_method_signature.py
index e2ae33857..146308b03 100644
--- a/tests/functional/u/unexpected_special_method_signature.py
+++ b/tests/functional/u/unexpected_special_method_signature.py
@@ -128,7 +128,7 @@ class ThirdGoodContextManager:
# unexpected-special-method-signature
-# https://github.com/PyCQA/pylint/issues/6644
+# https://github.com/pylint-dev/pylint/issues/6644
class Philosopher:
def __init_subclass__(cls, default_name, **kwargs):
super().__init_subclass__(**kwargs)
diff --git a/tests/functional/u/ungrouped_imports.py b/tests/functional/u/ungrouped_imports.py
index ace3a8e3f..b94fbeef9 100644
--- a/tests/functional/u/ungrouped_imports.py
+++ b/tests/functional/u/ungrouped_imports.py
@@ -26,7 +26,7 @@ from unittest import TestCase
from unittest.mock import MagicMock
-# https://github.com/PyCQA/pylint/issues/3382
+# https://github.com/pylint-dev/pylint/issues/3382
# Imports in a `if TYPE_CHECKING` block should not trigger `ungrouped-imports`
from typing import TYPE_CHECKING
if TYPE_CHECKING:
diff --git a/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py b/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py
index 74bf4e611..e02df87e3 100644
--- a/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py
+++ b/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py
@@ -73,7 +73,7 @@ for item in d.items():
# Test false positive described in #4630
-# (https://github.com/PyCQA/pylint/issues/4630)
+# (https://github.com/pylint-dev/pylint/issues/4630)
d = {'key': 'value'}
@@ -90,7 +90,7 @@ for k, _ in d.items():
# Test false positive described in #4716
# Should not be emitted for del
-# (https://github.com/PyCQA/pylint/issues/4716)
+# (https://github.com/pylint-dev/pylint/issues/4716)
d = {}
for key, val in d.items():
del d[key]
@@ -107,25 +107,25 @@ for key, val in outer_dict.items():
break
# Test partial unpacking of items
-# https://github.com/PyCQA/pylint/issues/5504
+# https://github.com/pylint-dev/pylint/issues/5504
d = {}
for key, in d.items():
print(d[key])
# Test subscripting an attribute
-# https://github.com/PyCQA/pylint/issues/6557
+# https://github.com/pylint-dev/pylint/issues/6557
f = Foo()
for input_output in d.items():
f.input_output = input_output # pylint: disable=attribute-defined-outside-init
print(d[f.input_output[0]])
-# Regression test for https://github.com/PyCQA/pylint/issues/6788
+# Regression test for https://github.com/pylint-dev/pylint/issues/6788
d = {'a': 1, 'b': 2, 'c': 3}
for key, val in d.items():
([d[key], x], y) = ([1, 2], 3)
-# Regression test for https://github.com/PyCQA/pylint/issues/6818
+# Regression test for https://github.com/pylint-dev/pylint/issues/6818
d = {'a': 1, 'b': 2, 'c': 3}
for key, val in d.items():
while d[key] > 0:
diff --git a/tests/functional/u/unnecessary/unnecessary_ellipsis.py b/tests/functional/u/unnecessary/unnecessary_ellipsis.py
index c46fd323a..081c4beda 100644
--- a/tests/functional/u/unnecessary/unnecessary_ellipsis.py
+++ b/tests/functional/u/unnecessary/unnecessary_ellipsis.py
@@ -123,7 +123,7 @@ def func1(val1, _):
def func2(val1, val2):
"""Ignore if ellipsis is used on comparisons.
- See https://github.com/PyCQA/pylint/issues/6071."""
+ See https://github.com/pylint-dev/pylint/issues/6071."""
if val1 is not ... and val2:
pass
diff --git a/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py b/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py
index ec5ee22c2..9e99388d8 100644
--- a/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py
+++ b/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py
@@ -45,16 +45,16 @@ result = [val for idx, val in enumerate(my_list) if idx > 0 and my_list[idx - 1]
result = [val for idx, val in enumerate(my_list) if other_list[idx] == 'a']
result = [my_list[idx] for idx, val in enumerate(my_list)] # [unnecessary-list-index-lookup]
-# Regression test for https://github.com/PyCQA/pylint/issues/6049
+# Regression test for https://github.com/pylint-dev/pylint/issues/6049
pairs = [(0, 0)]
for i, (a, b) in enumerate(pairs):
print(pairs[i][0])
-# Regression test for https://github.com/PyCQA/pylint/issues/6603
+# Regression test for https://github.com/pylint-dev/pylint/issues/6603
for i, num in enumerate(): # raises TypeError, but shouldn't crash pylint
pass
-# Regression test for https://github.com/PyCQA/pylint/issues/6788
+# Regression test for https://github.com/pylint-dev/pylint/issues/6788
num_list = [1, 2, 3]
for a, b in enumerate(num_list):
num_list[a], _ = (2, 1)
@@ -63,7 +63,7 @@ num_list = [1, 2, 3]
for a, b in enumerate(num_list):
([x, num_list[a]], _) = ([5, 6], 1)
-# Regression test for https://github.com/PyCQA/pylint/issues/6818
+# Regression test for https://github.com/pylint-dev/pylint/issues/6818
updated_list = [1, 2, 3]
for idx, val in enumerate(updated_list):
while updated_list[idx] > 0:
@@ -75,14 +75,14 @@ for idx, val in enumerate(updated_list):
updated_list[idx] -= 1
print(updated_list[idx])
-# Regression test for https://github.com/PyCQA/pylint/issues/6896
+# Regression test for https://github.com/pylint-dev/pylint/issues/6896
parts = ["a", "b", "c", "d"]
for i, part in enumerate(parts):
if i == 3: # more complex condition actually
parts.insert(i, "X")
print(part, parts[i])
-# regression tests for https://github.com/PyCQA/pylint/issues/7682
+# regression tests for https://github.com/pylint-dev/pylint/issues/7682
series = [1, 2, 3, 4, 5]
output_list = [
(item, series[index])
diff --git a/tests/functional/u/unpacking/unpacking_non_sequence_py37.py b/tests/functional/u/unpacking/unpacking_non_sequence_py37.py
index 13ab35b9a..3a1e3700a 100644
--- a/tests/functional/u/unpacking/unpacking_non_sequence_py37.py
+++ b/tests/functional/u/unpacking/unpacking_non_sequence_py37.py
@@ -1,11 +1,11 @@
"""
-https://github.com/PyCQA/pylint/issues/4895
+https://github.com/pylint-dev/pylint/issues/4895
"""
# pylint: disable=missing-docstring
# Disabled because of a bug with pypy 3.8 see
-# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369
+# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369
# pylint: disable=multiple-statements
from __future__ import annotations
diff --git a/tests/functional/u/unreachable.py b/tests/functional/u/unreachable.py
index 0211a6136..e59ad218f 100644
--- a/tests/functional/u/unreachable.py
+++ b/tests/functional/u/unreachable.py
@@ -25,7 +25,7 @@ def func4():
return 1 / 0 # [unreachable]
-# https://github.com/PyCQA/pylint/issues/4698
+# https://github.com/pylint-dev/pylint/issues/4698
def func5():
"""Empty generator functions should be allowed."""
return
diff --git a/tests/functional/u/unspecified_encoding_py38.py b/tests/functional/u/unspecified_encoding_py38.py
index 66b8523f4..6afdab92a 100644
--- a/tests/functional/u/unspecified_encoding_py38.py
+++ b/tests/functional/u/unspecified_encoding_py38.py
@@ -87,7 +87,7 @@ Path(FILENAME).open("w", encoding=LOCALE_ENCODING)
# Tests for storing data about open calls.
# Most of these are regression tests for a crash
-# reported in https://github.com/PyCQA/pylint/issues/5321
+# reported in https://github.com/pylint-dev/pylint/issues/5321
# -- Constants
MODE = "wb"
@@ -126,7 +126,7 @@ open(FILENAME, mode=IOData.mode)
open(FILENAME, mode=IOData().my_mode)
open(FILENAME, mode=IOData().my_mode_method())
open(FILENAME, mode=IOData().my_mode_method_returner("wb"))
-# Invalid value but shouldn't crash, reported in https://github.com/PyCQA/pylint/issues/5321
+# Invalid value but shouldn't crash, reported in https://github.com/pylint-dev/pylint/issues/5321
open(FILENAME, mode=IOData)
@@ -141,7 +141,7 @@ class IOArgs:
args_good_one = IOArgs(encoding=None, mode="wb")
-# Test for crash reported in https://github.com/PyCQA/pylint/issues/5321
+# Test for crash reported in https://github.com/pylint-dev/pylint/issues/5321
open(FILENAME, args_good_one.mode, encoding=args_good_one.encoding)
# Positional arguments
@@ -157,8 +157,8 @@ Path(FILENAME).read_text() # [unspecified-encoding]
Path(FILENAME).write_text("string", "utf-8")
Path(FILENAME).write_text("string") # [unspecified-encoding]
-# Test for crash reported in https://github.com/PyCQA/pylint/issues/5731
+# Test for crash reported in https://github.com/pylint-dev/pylint/issues/5731
open(FILENAME, mode=None) # [bad-open-mode, unspecified-encoding]
-# Test for crash reported in https://github.com/PyCQA/pylint/issues/6414
+# Test for crash reported in https://github.com/pylint-dev/pylint/issues/6414
open('foo', mode=2) # [bad-open-mode, unspecified-encoding]
diff --git a/tests/functional/u/unsubscriptable_object.py b/tests/functional/u/unsubscriptable_object.py
index 0b7da78b3..4f21871d0 100644
--- a/tests/functional/u/unsubscriptable_object.py
+++ b/tests/functional/u/unsubscriptable_object.py
@@ -1,7 +1,7 @@
"""Tests for unscubscriptable-object"""
# Test for typing.NamedTuple
-# See: https://github.com/PyCQA/pylint/issues/1295
+# See: https://github.com/pylint-dev/pylint/issues/1295
import typing
MyType = typing.Tuple[str, str]
diff --git a/tests/functional/u/unused/unused_argument.py b/tests/functional/u/unused/unused_argument.py
index 69c37feef..1d072f21b 100644
--- a/tests/functional/u/unused/unused_argument.py
+++ b/tests/functional/u/unused/unused_argument.py
@@ -94,7 +94,7 @@ class BBBB:
self.spam = 1
-# Regression test for https://github.com/PyCQA/pylint/issues/5771
+# Regression test for https://github.com/pylint-dev/pylint/issues/5771
# involving keyword-only arguments
class Ancestor:
def __init__(self):
diff --git a/tests/functional/u/unused/unused_import.py b/tests/functional/u/unused/unused_import.py
index 0abc7bf4d..c3d596b24 100644
--- a/tests/functional/u/unused/unused_import.py
+++ b/tests/functional/u/unused/unused_import.py
@@ -105,7 +105,7 @@ class WithMetaclass(six.with_metaclass(ABCMeta)):
Requires six."""
-# Regression test for https://github.com/PyCQA/pylint/issues/3765
+# Regression test for https://github.com/pylint-dev/pylint/issues/3765
# `unused-import` should not be emitted when a type annotation uses quotation marks
from typing import List
diff --git a/tests/functional/u/unused/unused_import_class_def_keyword.py b/tests/functional/u/unused/unused_import_class_def_keyword.py
index 0d6b59987..161d33cdb 100644
--- a/tests/functional/u/unused/unused_import_class_def_keyword.py
+++ b/tests/functional/u/unused/unused_import_class_def_keyword.py
@@ -1,7 +1,7 @@
"""
Test false-positive for unused-import on class keyword arguments
- https://github.com/PyCQA/pylint/issues/3202
+ https://github.com/pylint-dev/pylint/issues/3202
"""
# pylint: disable=missing-docstring,too-few-public-methods,invalid-name,import-error
diff --git a/tests/functional/u/unused/unused_import_everything_disabled.py b/tests/functional/u/unused/unused_import_everything_disabled.py
index 381cd012f..3c7d6c9ec 100644
--- a/tests/functional/u/unused/unused_import_everything_disabled.py
+++ b/tests/functional/u/unused/unused_import_everything_disabled.py
@@ -1,7 +1,7 @@
"""Test that unused-import is not emitted here when everything else is disabled
-https://github.com/PyCQA/pylint/issues/3445
-https://github.com/PyCQA/pylint/issues/6089
+https://github.com/pylint-dev/pylint/issues/3445
+https://github.com/pylint-dev/pylint/issues/6089
"""
from math import e, pi
from os import environ
diff --git a/tests/functional/u/unused/unused_import_positional_only_py38.py b/tests/functional/u/unused/unused_import_positional_only_py38.py
index 693a377d9..ceaad539d 100644
--- a/tests/functional/u/unused/unused_import_positional_only_py38.py
+++ b/tests/functional/u/unused/unused_import_positional_only_py38.py
@@ -1,6 +1,6 @@
"""Test that positional only argument annotations are properly marked as consumed
-https://github.com/PyCQA/pylint/issues/3462
+https://github.com/pylint-dev/pylint/issues/3462
"""
from typing import AnyStr, Set
diff --git a/tests/functional/u/unused/unused_private_member.py b/tests/functional/u/unused/unused_private_member.py
index 1696fb691..6b14b001f 100644
--- a/tests/functional/u/unused/unused_private_member.py
+++ b/tests/functional/u/unused/unused_private_member.py
@@ -106,7 +106,7 @@ k = Klass()
print(k.twentyone)
print(k.ninetyfive)
-# https://github.com/PyCQA/pylint/issues/4657
+# https://github.com/pylint-dev/pylint/issues/4657
# Mutation of class member with cls should not fire a false-positive
class FalsePositive4657:
"""False positive tests for 4657"""
@@ -140,7 +140,7 @@ class FalsePositive4657:
return cls.__attr_c # [undefined-variable]
-# https://github.com/PyCQA/pylint/issues/4668
+# https://github.com/pylint-dev/pylint/issues/4668
# Attributes assigned within __new__() has to be processed as part of the class
class FalsePositive4668:
# pylint: disable=protected-access, no-member, unreachable
@@ -166,7 +166,7 @@ class FalsePositive4668:
return self.func(*self.__args)
-# https://github.com/PyCQA/pylint/issues/4673
+# https://github.com/pylint-dev/pylint/issues/4673
# Nested functions shouldn't cause a false positive if they are properly used
class FalsePositive4673:
""" The testing class """
@@ -207,7 +207,7 @@ class FalsePositive4673:
return fn_to_return
-# https://github.com/PyCQA/pylint/issues/4755
+# https://github.com/pylint-dev/pylint/issues/4755
# Nested attributes shouldn't cause crash
class Crash4755Context:
def __init__(self):
@@ -223,7 +223,7 @@ class Crash4755Command:
print(message)
-# https://github.com/PyCQA/pylint/issues/4681
+# https://github.com/pylint-dev/pylint/issues/4681
# Accessing attributes of the class using the class name should not result in a false positive
# as long as it is used within the class
class FalsePositive4681:
@@ -263,7 +263,7 @@ class FalsePositive4681b:
FalsePositive4681b.__instance = False # This should be fine
-# https://github.com/PyCQA/pylint/issues/4849
+# https://github.com/pylint-dev/pylint/issues/4849
# Accessing private static methods from classmethods via `cls` should not result in a
# false positive
class FalsePositive4849:
@@ -283,7 +283,7 @@ class FalsePositive4849:
class Pony:
- """https://github.com/PyCQA/pylint/issues/4837"""
+ """https://github.com/pylint-dev/pylint/issues/4837"""
__defaults = {}
__defaults_set = False
@@ -305,7 +305,7 @@ def lookup_attribute(mapping, key):
# Test for regression on checking __class__ attribute
-# See: https://github.com/PyCQA/pylint/issues/5261
+# See: https://github.com/pylint-dev/pylint/issues/5261
class Foo:
__ham = 1
@@ -313,7 +313,7 @@ class Foo:
print(self.__class__.__ham)
-# https://github.com/PyCQA/pylint/issues/4756
+# https://github.com/pylint-dev/pylint/issues/4756
# Check for false positives emitted when private functions are not referenced in the class body
# with standard calls but passed as arguments to other functions.
class FalsePositive4756a:
@@ -347,7 +347,7 @@ class TypeSelfCallInMethod:
class Item:
- """Regression test for https://github.com/PyCQA/pylint/issues/6709"""
+ """Regression test for https://github.com/pylint-dev/pylint/issues/6709"""
def __init__(self, parent):
self.__parent: Item = parent
self.__item = self.__parent.__item # [unused-private-member]
diff --git a/tests/functional/u/unused/unused_typing_imports.py b/tests/functional/u/unused/unused_typing_imports.py
index 7de4e411b..3b9b7aa06 100644
--- a/tests/functional/u/unused/unused_typing_imports.py
+++ b/tests/functional/u/unused/unused_typing_imports.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring
-"""Regression test for https://github.com/PyCQA/pylint/issues/1168
+"""Regression test for https://github.com/pylint-dev/pylint/issues/1168
The problem was that we weren't handling keyword-only arguments annotations,
which means we were never processing them.
diff --git a/tests/functional/u/unused/unused_variable.py b/tests/functional/u/unused/unused_variable.py
index 0058516c9..9dabe5b59 100644
--- a/tests/functional/u/unused/unused_variable.py
+++ b/tests/functional/u/unused/unused_variable.py
@@ -155,7 +155,7 @@ def func4():
def main(lst):
- """https://github.com/PyCQA/astroid/pull/1111#issuecomment-890367609"""
+ """https://github.com/pylint-dev/astroid/pull/1111#issuecomment-890367609"""
try:
raise ValueError
except ValueError as e: # [unused-variable]
diff --git a/tests/functional/u/unused/unused_variable_after_inference.py b/tests/functional/u/unused/unused_variable_after_inference.py
index 569564dc9..5020cd32f 100644
--- a/tests/functional/u/unused/unused_variable_after_inference.py
+++ b/tests/functional/u/unused/unused_variable_after_inference.py
@@ -1,4 +1,4 @@
-"""Regression test for https://github.com/PyCQA/pylint/issues/6895"""
+"""Regression test for https://github.com/pylint-dev/pylint/issues/6895"""
# pylint: disable=missing-class-docstring,too-few-public-methods
import argparse
class Cls:
diff --git a/tests/functional/u/use/use_a_generator.py b/tests/functional/u/use/use_a_generator.py
index 279deb46f..6327eb1a2 100644
--- a/tests/functional/u/use/use_a_generator.py
+++ b/tests/functional/u/use/use_a_generator.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring, invalid-name
-# https://github.com/PyCQA/pylint/issues/3165
+# https://github.com/pylint-dev/pylint/issues/3165
any([])
all([])
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison.py b/tests/functional/u/use/use_implicit_booleaness_not_comparison.py
index 681ee0607..26b6aeaef 100644
--- a/tests/functional/u/use/use_implicit_booleaness_not_comparison.py
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison.py
@@ -1,11 +1,11 @@
# pylint: disable=missing-docstring, missing-module-docstring, invalid-name
# pylint: disable=too-few-public-methods, line-too-long, dangerous-default-value
# pylint: disable=wrong-import-order
-# https://github.com/PyCQA/pylint/issues/4774
+# https://github.com/pylint-dev/pylint/issues/4774
def github_issue_4774():
# Test literals
- # https://github.com/PyCQA/pylint/issues/4774
+ # https://github.com/pylint-dev/pylint/issues/4774
good_list = []
if not good_list:
pass
@@ -197,7 +197,7 @@ if long_test == { }: # [use-implicit-booleaness-not-comparison]
# Check for properties and uninferable class methods
-# See https://github.com/PyCQA/pylint/issues/5646
+# See https://github.com/pylint-dev/pylint/issues/5646
from xyz import AnotherClassWithProperty
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt
index 2ace15d7e..f4cf77747 100644
--- a/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt
@@ -1,32 +1,32 @@
-use-implicit-booleaness-not-comparison:14:7:14:21:github_issue_4774:'bad_list == []' can be simplified to 'not bad_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:22:3:22:20::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:25:3:25:19::'empty_list == []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:28:3:28:19::'empty_dict == {}' can be simplified to 'not empty_dict' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:31:3:31:20::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:34:3:34:19::'empty_list == []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:37:3:37:19::'empty_dict == {}' can be simplified to 'not empty_dict' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:42:11:42:18:bad_tuple_return:'t == ()' can be simplified to 'not t' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:46:11:46:18:bad_list_return:'b == []' can be simplified to 'not b' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:50:11:50:18:bad_dict_return:'c == {}' can be simplified to 'not c' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:52:7:52:24::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:53:7:53:23::'empty_list == []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:54:7:54:23::'empty_dict != {}' can be simplified to 'empty_dict' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:55:7:55:23::'empty_tuple < ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:56:7:56:23::'empty_list <= []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:57:7:57:23::'empty_tuple > ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:58:7:58:23::'empty_list >= []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:83:3:83:10::'a == []' can be simplified to 'not a' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:95:3:95:10::'e == []' can be simplified to 'not e' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:95:15:95:22::'f == {}' can be simplified to 'not f' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:133:3:133:14::'A.lst == []' can be simplified to 'not A.lst' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:137:3:137:14::'A.lst == []' can be simplified to 'not A.lst' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:141:3:141:20::'A.test(...) == []' can be simplified to 'not A.test(...)' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:149:3:149:24::'test_function(...) == []' can be simplified to 'not test_function(...)' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:156:3:156:20::'numpy_array == []' can be simplified to 'not numpy_array' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:158:3:158:20::'numpy_array != []' can be simplified to 'numpy_array' as an empty list is falsey:HIGH
-use-implicit-booleaness-not-comparison:160:3:160:20::'numpy_array >= ()' can be simplified to 'not numpy_array' as an empty tuple is falsey:HIGH
-use-implicit-booleaness-not-comparison:185:3:185:13::'data == {}' can be simplified to 'not data' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:187:3:187:13::'data != {}' can be simplified to 'data' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:195:3:195:26::'long_test == {}' can be simplified to 'not long_test' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:233:11:233:41:test_func:'my_class.parent_function == {}' can be simplified to 'not my_class.parent_function' as an empty dict is falsey:HIGH
-use-implicit-booleaness-not-comparison:234:11:234:37:test_func:'my_class.my_property == {}' can be simplified to 'not my_class.my_property' as an empty dict is falsey:HIGH
+use-implicit-booleaness-not-comparison:14:7:14:21:github_issue_4774:"""bad_list == []"" can be simplified to ""not bad_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:22:3:22:20::"""empty_tuple == ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:25:3:25:19::"""empty_list == []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:28:3:28:19::"""empty_dict == {}"" can be simplified to ""not empty_dict"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:31:3:31:20::"""empty_tuple == ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:34:3:34:19::"""empty_list == []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:37:3:37:19::"""empty_dict == {}"" can be simplified to ""not empty_dict"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:42:11:42:18:bad_tuple_return:"""t == ()"" can be simplified to ""not t"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:46:11:46:18:bad_list_return:"""b == []"" can be simplified to ""not b"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:50:11:50:18:bad_dict_return:"""c == {}"" can be simplified to ""not c"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:52:7:52:24::"""empty_tuple == ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:53:7:53:23::"""empty_list == []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:54:7:54:23::"""empty_dict != {}"" can be simplified to ""empty_dict"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:55:7:55:23::"""empty_tuple < ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:56:7:56:23::"""empty_list <= []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:57:7:57:23::"""empty_tuple > ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:58:7:58:23::"""empty_list >= []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:83:3:83:10::"""a == []"" can be simplified to ""not a"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:95:3:95:10::"""e == []"" can be simplified to ""not e"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:95:15:95:22::"""f == {}"" can be simplified to ""not f"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:133:3:133:14::"""A.lst == []"" can be simplified to ""not A.lst"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:137:3:137:14::"""A.lst == []"" can be simplified to ""not A.lst"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:141:3:141:20::"""A.test(...) == []"" can be simplified to ""not A.test(...)"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:149:3:149:24::"""test_function(...) == []"" can be simplified to ""not test_function(...)"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:156:3:156:20::"""numpy_array == []"" can be simplified to ""not numpy_array"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:158:3:158:20::"""numpy_array != []"" can be simplified to ""numpy_array"", if it is strictly a sequence, as an empty list is falsey":HIGH
+use-implicit-booleaness-not-comparison:160:3:160:20::"""numpy_array >= ()"" can be simplified to ""not numpy_array"", if it is strictly a sequence, as an empty tuple is falsey":HIGH
+use-implicit-booleaness-not-comparison:185:3:185:13::"""data == {}"" can be simplified to ""not data"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:187:3:187:13::"""data != {}"" can be simplified to ""data"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:195:3:195:26::"""long_test == {}"" can be simplified to ""not long_test"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:233:11:233:41:test_func:"""my_class.parent_function == {}"" can be simplified to ""not my_class.parent_function"", if it is strictly a sequence, as an empty dict is falsey":HIGH
+use-implicit-booleaness-not-comparison:234:11:234:37:test_func:"""my_class.my_property == {}"" can be simplified to ""not my_class.my_property"", if it is strictly a sequence, as an empty dict is falsey":HIGH
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py
new file mode 100644
index 000000000..4fbf0fc1d
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py
@@ -0,0 +1,22 @@
+# pylint: disable=literal-comparison,missing-docstring
+
+X = ''
+Y = 'test'
+
+if X is '': # [use-implicit-booleaness-not-comparison-to-string]
+ pass
+
+if Y is not "": # [use-implicit-booleaness-not-comparison-to-string]
+ pass
+
+if X == "": # [use-implicit-booleaness-not-comparison-to-string]
+ pass
+
+if Y != '': # [use-implicit-booleaness-not-comparison-to-string]
+ pass
+
+if "" == Y: # [use-implicit-booleaness-not-comparison-to-string]
+ pass
+
+if '' != X: # [use-implicit-booleaness-not-comparison-to-string]
+ pass
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc
new file mode 100644
index 000000000..14648884d
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc
@@ -0,0 +1,2 @@
+[MAIN]
+enable=use-implicit-booleaness-not-comparison-to-string
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt
new file mode 100644
index 000000000..5f07a683c
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt
@@ -0,0 +1,6 @@
+use-implicit-booleaness-not-comparison-to-string:6:3:6:10::"""X is ''"" can be simplified to ""not X"", if it is striclty a string, as an empty string is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-string:9:3:9:14::"""Y is not ''"" can be simplified to ""Y"", if it is striclty a string, as an empty string is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-string:12:3:12:10::"""X == ''"" can be simplified to ""not X"", if it is striclty a string, as an empty string is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-string:15:3:15:10::"""Y != ''"" can be simplified to ""Y"", if it is striclty a string, as an empty string is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-string:18:3:18:10::"""'' == Y"" can be simplified to ""not Y"", if it is striclty a string, as an empty string is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-string:21:3:21:10::"""'' != X"" can be simplified to ""X"", if it is striclty a string, as an empty string is falsey":HIGH
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py
new file mode 100644
index 000000000..766b1f547
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py
@@ -0,0 +1,46 @@
+# pylint: disable=literal-comparison,missing-docstring, singleton-comparison
+
+X = 123
+Y = len('test')
+
+if X is 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if X is False:
+ pass
+
+if Y is not 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if Y is not False:
+ pass
+
+if X == 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if X == False:
+ pass
+
+if 0 == Y: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if Y != 0: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if 0 != X: # [use-implicit-booleaness-not-comparison-to-zero]
+ pass
+
+if Y != False:
+ pass
+
+if X > 0:
+ pass
+
+if X < 0:
+ pass
+
+if 0 < X:
+ pass
+
+if 0 > X:
+ pass
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc
new file mode 100644
index 000000000..be01705b1
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc
@@ -0,0 +1,2 @@
+[MAIN]
+enable=compare-to-zero,
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt
new file mode 100644
index 000000000..cb7d57699
--- /dev/null
+++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt
@@ -0,0 +1,6 @@
+use-implicit-booleaness-not-comparison-to-zero:6:3:6:9::"""X is 0"" can be simplified to ""not X"", if it is strictly an int, as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:12:3:12:13::"""Y is not 0"" can be simplified to ""Y"", if it is strictly an int, as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:18:3:18:9::"""X == 0"" can be simplified to ""not X"", if it is strictly an int, as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:24:3:24:9::"""0 == Y"" can be simplified to ""not Y"", if it is strictly an int, as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:27:3:27:9::"""Y != 0"" can be simplified to ""Y"", if it is strictly an int, as 0 is falsey":HIGH
+use-implicit-booleaness-not-comparison-to-zero:30:3:30:9::"""0 != X"" can be simplified to ""X"", if it is strictly an int, as 0 is falsey":HIGH
diff --git a/tests/functional/u/use/use_implicit_booleaness_not_len.py b/tests/functional/u/use/use_implicit_booleaness_not_len.py
index 4002a6dda..79547d99e 100644
--- a/tests/functional/u/use/use_implicit_booleaness_not_len.py
+++ b/tests/functional/u/use/use_implicit_booleaness_not_len.py
@@ -158,28 +158,28 @@ def github_issue_1879():
return 1
return 2
- # def function_returning_generator(r):
- # for i in [r, 1, 2, 3]:
- # yield i
+ def function_returning_generator(r):
+ for i in [r, 1, 2, 3]:
+ yield i
- # def function_returning_comprehension(r):
- # return [x+1 for x in [r, 1, 2, 3]]
+ def function_returning_comprehension(r):
+ return [x+1 for x in [r, 1, 2, 3]]
- # def function_returning_function(r):
- # return function_returning_generator(r)
+ def function_returning_function(r):
+ return function_returning_generator(r)
assert len(function_returning_list(z)) # [use-implicit-booleaness-not-len]
assert len(function_returning_int(z))
# This should raise a use-implicit-booleaness-not-len once astroid can infer it
- # See https://github.com/PyCQA/pylint/pull/3821#issuecomment-743771514
- # assert len(function_returning_generator(z))
- # assert len(function_returning_comprehension(z))
- # assert len(function_returning_function(z))
+ # See https://github.com/pylint-dev/pylint/pull/3821#issuecomment-743771514
+ assert len(function_returning_generator(z))
+ assert len(function_returning_comprehension(z))
+ assert len(function_returning_function(z))
def github_issue_4215():
# Test undefined variables
- # https://github.com/PyCQA/pylint/issues/4215
+ # https://github.com/pylint-dev/pylint/issues/4215
if len(undefined_var): # [undefined-variable]
pass
if len(undefined_var2[0]): # [undefined-variable]
diff --git a/tests/functional/u/use/use_maxsplit_arg.py b/tests/functional/u/use/use_maxsplit_arg.py
index 449457a0c..11e51c116 100644
--- a/tests/functional/u/use/use_maxsplit_arg.py
+++ b/tests/functional/u/use/use_maxsplit_arg.py
@@ -84,7 +84,7 @@ a = "1,2,3".split('split')[-1] # [use-maxsplit-arg]
a = "1,2,3".rsplit('rsplit')[0] # [use-maxsplit-arg]
# Test cases for false-positive reported in #4664
-# https://github.com/PyCQA/pylint/issues/4664
+# https://github.com/pylint-dev/pylint/issues/4664
source = 'A.B.C.D.E.F.G'
i = 0
for j in range(5):
@@ -92,7 +92,7 @@ for j in range(5):
i = i + 1
# Test for crash when sep is given by keyword
-# https://github.com/PyCQA/pylint/issues/5737
+# https://github.com/pylint-dev/pylint/issues/5737
get_last = SEQ.split(sep=None)[-1] # [use-maxsplit-arg]
diff --git a/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py b/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py
index a43a89aa1..e0d874ff8 100644
--- a/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py
+++ b/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py
@@ -1,6 +1,6 @@
"""Tests for used-before-assignment with assignments in except handlers after
try blocks with return statements.
-See: https://github.com/PyCQA/pylint/issues/5500.
+See: https://github.com/pylint-dev/pylint/issues/5500.
"""
# pylint: disable=inconsistent-return-statements
diff --git a/tests/functional/u/used/used_before_assignment.py b/tests/functional/u/used/used_before_assignment.py
index d36b2fd8d..9b7d668ca 100644
--- a/tests/functional/u/used/used_before_assignment.py
+++ b/tests/functional/u/used/used_before_assignment.py
@@ -1,6 +1,6 @@
"""Miscellaneous used-before-assignment cases"""
# pylint: disable=consider-using-f-string, missing-function-docstring
-
+import datetime
MSG = "hello %s" % MSG # [used-before-assignment]
@@ -14,6 +14,17 @@ def outer():
outer()
+class ClassWithProperty: # pylint: disable=too-few-public-methods
+ """This test depends on earlier and later defined module-level functions."""
+ prop = property(redefine_time_import) # [used-before-assignment]
+ prop_defined_earlier = property(outer)
+
+
+calculate(1.01, 2) # [used-before-assignment]
+def calculate(value1: int, value2: float) -> int:
+ return value1 + value2
+
+
# pylint: disable=unused-import, wrong-import-position, import-outside-toplevel, reimported, redefined-outer-name, global-statement
import time
def redefine_time_import():
@@ -108,7 +119,7 @@ for num in [0, 1]:
print(VAR12)
def turn_on2(**kwargs):
- """https://github.com/PyCQA/pylint/issues/7873"""
+ """https://github.com/pylint-dev/pylint/issues/7873"""
if "brightness" in kwargs:
brightness = kwargs["brightness"]
var, *args = (1, "set_dimmer_state", brightness)
@@ -116,3 +127,50 @@ def turn_on2(**kwargs):
var, *args = (1, "restore_dimmer_state")
print(var, *args)
+
+
+# Variables guarded by the same test when used.
+
+# Always false
+if __name__ == "__main__":
+ PERCENT = 20
+ SALE = True
+
+if __name__ == "__main__":
+ print(PERCENT)
+
+# Different test
+if __name__ is None:
+ print(SALE) # [used-before-assignment]
+
+
+# Ambiguous, but same test
+if not datetime.date.today():
+ WAS_TODAY = True
+
+if not datetime.date.today():
+ print(WAS_TODAY)
+
+
+# Different tests but same inferred values
+# Need falsy values here
+def give_me_zero():
+ return 0
+
+def give_me_nothing():
+ return 0
+
+if give_me_zero():
+ WE_HAVE_ZERO = True
+ ALL_DONE = True
+
+if give_me_nothing():
+ print(WE_HAVE_ZERO)
+
+
+# Different tests, different values
+def give_me_none():
+ return None
+
+if give_me_none():
+ print(ALL_DONE) # [used-before-assignment]
diff --git a/tests/functional/u/used/used_before_assignment.txt b/tests/functional/u/used/used_before_assignment.txt
index 70153f39a..37b25ab49 100644
--- a/tests/functional/u/used/used_before_assignment.txt
+++ b/tests/functional/u/used/used_before_assignment.txt
@@ -1,8 +1,12 @@
used-before-assignment:5:19:5:22::Using variable 'MSG' before assignment:HIGH
used-before-assignment:7:20:7:24::Using variable 'MSG2' before assignment:HIGH
used-before-assignment:10:4:10:9:outer:Using variable 'inner' before assignment:HIGH
-used-before-assignment:20:10:20:14:redefine_time_import:Using variable 'time' before assignment:HIGH
-used-before-assignment:34:3:34:7::Using variable 'VAR2' before assignment:CONTROL_FLOW
-used-before-assignment:52:3:52:7::Using variable 'VAR4' before assignment:CONTROL_FLOW
-used-before-assignment:67:3:67:7::Using variable 'VAR6' before assignment:CONTROL_FLOW
-used-before-assignment:102:6:102:11::Using variable 'VAR10' before assignment:CONTROL_FLOW
+used-before-assignment:19:20:19:40:ClassWithProperty:Using variable 'redefine_time_import' before assignment:HIGH
+used-before-assignment:23:0:23:9::Using variable 'calculate' before assignment:HIGH
+used-before-assignment:31:10:31:14:redefine_time_import:Using variable 'time' before assignment:HIGH
+used-before-assignment:45:3:45:7::Using variable 'VAR2' before assignment:CONTROL_FLOW
+used-before-assignment:63:3:63:7::Using variable 'VAR4' before assignment:CONTROL_FLOW
+used-before-assignment:78:3:78:7::Using variable 'VAR6' before assignment:CONTROL_FLOW
+used-before-assignment:113:6:113:11::Using variable 'VAR10' before assignment:CONTROL_FLOW
+used-before-assignment:144:10:144:14::Using variable 'SALE' before assignment:CONTROL_FLOW
+used-before-assignment:176:10:176:18::Using variable 'ALL_DONE' before assignment:CONTROL_FLOW
diff --git a/tests/functional/u/used/used_before_assignment_class_nested_under_function.py b/tests/functional/u/used/used_before_assignment_class_nested_under_function.py
index 3627ae1e1..43734757b 100644
--- a/tests/functional/u/used/used_before_assignment_class_nested_under_function.py
+++ b/tests/functional/u/used/used_before_assignment_class_nested_under_function.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/4590"""
+"""https://github.com/pylint-dev/pylint/issues/4590"""
# pylint: disable=too-few-public-methods
diff --git a/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py b/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py
index 2321afed7..6c7fe411a 100644
--- a/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py
+++ b/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py
@@ -2,7 +2,7 @@
# pylint: disable=broad-exception-raised
def func():
- """https://github.com/PyCQA/pylint/issues/5586"""
+ """https://github.com/pylint-dev/pylint/issues/5586"""
try:
print(value for value in range(1 / 0) if isinstance(value, int))
except ZeroDivisionError:
@@ -29,7 +29,7 @@ def func3():
def func4():
- """https://github.com/PyCQA/pylint/issues/6035"""
+ """https://github.com/pylint-dev/pylint/issues/6035"""
assets = [asset for asset in range(3) if asset.name == "filename"]
try:
@@ -54,7 +54,7 @@ def func5():
def func6(data, keys):
"""Similar, but with a subscript in a key-value pair rather than the test
- See https://github.com/PyCQA/pylint/issues/6069"""
+ See https://github.com/pylint-dev/pylint/issues/6069"""
try:
results = {key: data[key] for key in keys}
except KeyError as exc:
diff --git a/tests/functional/u/used/used_before_assignment_else_return.py b/tests/functional/u/used/used_before_assignment_else_return.py
index a7e58bb61..8dcd21337 100644
--- a/tests/functional/u/used/used_before_assignment_else_return.py
+++ b/tests/functional/u/used/used_before_assignment_else_return.py
@@ -3,7 +3,7 @@
import sys
def valid():
- """https://github.com/PyCQA/pylint/issues/6790"""
+ """https://github.com/pylint-dev/pylint/issues/6790"""
try:
pass
except ValueError:
diff --git a/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py b/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py
index c83a48473..418fee298 100644
--- a/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py
+++ b/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py
@@ -1,6 +1,6 @@
"""Tests for used-before-assignment with assignments in except handlers after
try blocks with return statements.
-See: https://github.com/PyCQA/pylint/issues/5500.
+See: https://github.com/pylint-dev/pylint/issues/5500.
"""
# pylint: disable=inconsistent-return-statements,broad-exception-raised
diff --git a/tests/functional/u/used/used_before_assignment_issue2615.py b/tests/functional/u/used/used_before_assignment_issue2615.py
index bce073bf3..e2e5a4181 100644
--- a/tests/functional/u/used/used_before_assignment_issue2615.py
+++ b/tests/functional/u/used/used_before_assignment_issue2615.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/2615"""
+"""https://github.com/pylint-dev/pylint/issues/2615"""
def main():
"""When evaluating except blocks, assume try statements fail."""
try:
diff --git a/tests/functional/u/used/used_before_assignment_issue4761.py b/tests/functional/u/used/used_before_assignment_issue4761.py
index 6f8e048e4..7ba77be62 100644
--- a/tests/functional/u/used/used_before_assignment_issue4761.py
+++ b/tests/functional/u/used/used_before_assignment_issue4761.py
@@ -13,7 +13,7 @@ def function():
def uses_nonlocal():
- """https://github.com/PyCQA/pylint/issues/5965"""
+ """https://github.com/pylint-dev/pylint/issues/5965"""
count = 0
def inner():
nonlocal count
@@ -46,7 +46,7 @@ def uses_unrelated_nonlocal():
# only non-break exit branch.
def valid_only_non_break_exit_from_loop_is_except_handler():
- """https://github.com/PyCQA/pylint/issues/5683"""
+ """https://github.com/pylint-dev/pylint/issues/5683"""
for _ in range(3):
try:
function() # not an exit branch because of `else` below
diff --git a/tests/functional/u/used/used_before_assignment_issue85.py b/tests/functional/u/used/used_before_assignment_issue85.py
index 367af9dfa..7ede436bb 100644
--- a/tests/functional/u/used/used_before_assignment_issue85.py
+++ b/tests/functional/u/used/used_before_assignment_issue85.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/85"""
+"""https://github.com/pylint-dev/pylint/issues/85"""
def main():
"""When evaluating finally blocks, assume try statements fail."""
try:
@@ -54,7 +54,7 @@ def try_except_finally_nested_try_finally_in_try():
def try_except_finally_nested_in_finally():
"""Until Pylint comes to a consensus on requiring all except handlers to
- define a name, raise, or return (https://github.com/PyCQA/pylint/issues/5524),
+ define a name, raise, or return (https://github.com/pylint-dev/pylint/issues/5524),
Pylint assumes statements in try blocks succeed when accessed *after*
except or finally blocks and fail when accessed *in* except or finally
blocks.)
diff --git a/tests/functional/u/used/used_before_assignment_nonlocal.py b/tests/functional/u/used/used_before_assignment_nonlocal.py
index 18e16177d..4d926e9eb 100644
--- a/tests/functional/u/used/used_before_assignment_nonlocal.py
+++ b/tests/functional/u/used/used_before_assignment_nonlocal.py
@@ -60,7 +60,7 @@ nonlocal_in_ifexp()
def type_annotation_only_gets_value_via_nonlocal():
- """https://github.com/PyCQA/pylint/issues/5394"""
+ """https://github.com/pylint-dev/pylint/issues/5394"""
some_num: int
def inner():
nonlocal some_num
diff --git a/tests/functional/u/used/used_before_assignment_postponed_evaluation.py b/tests/functional/u/used/used_before_assignment_postponed_evaluation.py
new file mode 100644
index 000000000..4ff22470c
--- /dev/null
+++ b/tests/functional/u/used/used_before_assignment_postponed_evaluation.py
@@ -0,0 +1,13 @@
+"""Tests for used-before-assignment when postponed evaluation of annotations is enabled"""
+# pylint: disable=missing-function-docstring, invalid-name
+from __future__ import annotations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ var = 1
+ import math
+
+print(var) # [used-before-assignment]
+
+def function_one(m: math): # no error for annotations
+ return m
diff --git a/tests/functional/u/used/used_before_assignment_postponed_evaluation.txt b/tests/functional/u/used/used_before_assignment_postponed_evaluation.txt
new file mode 100644
index 000000000..88a958736
--- /dev/null
+++ b/tests/functional/u/used/used_before_assignment_postponed_evaluation.txt
@@ -0,0 +1 @@
+used-before-assignment:10:6:10:9::Using variable 'var' before assignment:CONTROL_FLOW
diff --git a/tests/functional/u/used/used_before_assignment_py37.py b/tests/functional/u/used/used_before_assignment_py37.py
index c64bf7cf5..1b0a895bf 100644
--- a/tests/functional/u/used/used_before_assignment_py37.py
+++ b/tests/functional/u/used/used_before_assignment_py37.py
@@ -30,6 +30,6 @@ class MyClass:
class NamedTupleSubclass(namedtuple("NamedTupleSubclass", [])):
- """Taken from https://github.com/PyCQA/pylint/issues/5982"""
+ """Taken from https://github.com/pylint-dev/pylint/issues/5982"""
def method(self) -> NamedTupleSubclass:
"""Variables checker crashed when astroid did not supply a lineno"""
diff --git a/tests/functional/u/used/used_before_assignment_scoping.py b/tests/functional/u/used/used_before_assignment_scoping.py
new file mode 100644
index 000000000..0d88210bd
--- /dev/null
+++ b/tests/functional/u/used/used_before_assignment_scoping.py
@@ -0,0 +1,18 @@
+# pylint: disable=missing-function-docstring, missing-module-docstring
+
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from datetime import datetime
+
+
+def func_two():
+ second = datetime.now() # [used-before-assignment]
+ return second
+
+
+def func():
+ first: datetime
+ first = datetime.now() # [used-before-assignment]
+ second = datetime.now()
+ return first, second
diff --git a/tests/functional/u/used/used_before_assignment_scoping.txt b/tests/functional/u/used/used_before_assignment_scoping.txt
new file mode 100644
index 000000000..32b6d3e1b
--- /dev/null
+++ b/tests/functional/u/used/used_before_assignment_scoping.txt
@@ -0,0 +1,2 @@
+used-before-assignment:10:13:10:21:func_two:Using variable 'datetime' before assignment:CONTROL_FLOW
+used-before-assignment:16:12:16:20:func:Using variable 'datetime' before assignment:CONTROL_FLOW
diff --git a/tests/functional/u/used/used_before_assignment_ternary.txt b/tests/functional/u/used/used_before_assignment_ternary.txt
index d991970e4..bcb21df1c 100644
--- a/tests/functional/u/used/used_before_assignment_ternary.txt
+++ b/tests/functional/u/used/used_before_assignment_ternary.txt
@@ -1,3 +1,3 @@
-used-before-assignment:6:14:6:15:invalid:Using variable 'a' before assignment:HIGH
-used-before-assignment:8:14:8:15:invalid:Using variable 'b' before assignment:HIGH
-used-before-assignment:9:10:9:11:invalid:Using variable 'c' before assignment:HIGH
+used-before-assignment:6:14:6:15:invalid:Using variable 'a' before assignment:HIGH
+used-before-assignment:8:14:8:15:invalid:Using variable 'b' before assignment:HIGH
+used-before-assignment:9:10:9:11:invalid:Using variable 'c' before assignment:HIGH
diff --git a/tests/functional/u/used/used_before_assignment_type_annotations.py b/tests/functional/u/used/used_before_assignment_type_annotations.py
index 1a03050c3..e70a911ca 100644
--- a/tests/functional/u/used/used_before_assignment_type_annotations.py
+++ b/tests/functional/u/used/used_before_assignment_type_annotations.py
@@ -77,7 +77,7 @@ def typing_and_value_assignment_with_tuple_assignment():
def nested_class_as_return_annotation():
"""A namedtuple as a class attribute is used as a return annotation
- Taken from https://github.com/PyCQA/pylint/issues/5568"""
+ Taken from https://github.com/pylint-dev/pylint/issues/5568"""
class MyObject:
"""namedtuple as class attribute"""
Coords = namedtuple('Point', ['x', 'y'])
diff --git a/tests/functional/u/used/used_before_assignment_typing.py b/tests/functional/u/used/used_before_assignment_typing.py
index a685bdabc..9ec040ff6 100644
--- a/tests/functional/u/used/used_before_assignment_typing.py
+++ b/tests/functional/u/used/used_before_assignment_typing.py
@@ -7,11 +7,12 @@ from typing import List, Optional, TYPE_CHECKING
if TYPE_CHECKING:
if True: # pylint: disable=using-constant-test
import math
+ import dbm
+ print(dbm) # no error when defined and used in the same false branch
from urllib.request import urlopen
import array
import base64
import binascii
- import bisect
import calendar
import collections
import copy
@@ -91,7 +92,7 @@ class MyClass:
class MySecondClass:
"""Class to test self referential variable typing.
- This regressed, reported in: https://github.com/PyCQA/pylint/issues/5342
+ This regressed, reported in: https://github.com/pylint-dev/pylint/issues/5342
"""
def self_referential_optional_within_method(self) -> None:
@@ -121,7 +122,7 @@ class MyOtherClass:
class MyThirdClass:
"""Class to test self referential variable typing within conditionals.
- This regressed, reported in: https://github.com/PyCQA/pylint/issues/5499
+ This regressed, reported in: https://github.com/pylint-dev/pylint/issues/5499
"""
def function(self, var: int) -> None:
@@ -134,7 +135,7 @@ class MyThirdClass:
class MyFourthClass: # pylint: disable=too-few-public-methods
"""Class to test conditional imports guarded by TYPE_CHECKING two levels
- up then used in function annotation. See https://github.com/PyCQA/pylint/issues/7539"""
+ up then used in function annotation. See https://github.com/pylint-dev/pylint/issues/7539"""
def is_close(self, comparator: math.isclose, first, second): # [used-before-assignment]
"""Conditional imports guarded are only valid for variable annotations."""
@@ -145,8 +146,8 @@ class VariableAnnotationsGuardedByTypeChecking: # pylint: disable=too-few-publi
"""Class to test conditional imports guarded by TYPE_CHECKING then used in
local (function) variable annotations, which are not evaluated at runtime.
- See: https://github.com/PyCQA/pylint/issues/7609
- and https://github.com/PyCQA/pylint/issues/7882
+ See: https://github.com/pylint-dev/pylint/issues/7609
+ and https://github.com/pylint-dev/pylint/issues/7882
"""
still_an_error: datetime.date # [used-before-assignment]
diff --git a/tests/functional/u/used/used_before_assignment_typing.txt b/tests/functional/u/used/used_before_assignment_typing.txt
index c0a31fae0..12794f0e9 100644
--- a/tests/functional/u/used/used_before_assignment_typing.txt
+++ b/tests/functional/u/used/used_before_assignment_typing.txt
@@ -1,5 +1,5 @@
-undefined-variable:68:21:68:28:MyClass.incorrect_typing_method:Undefined variable 'MyClass':UNDEFINED
-undefined-variable:73:26:73:33:MyClass.incorrect_nested_typing_method:Undefined variable 'MyClass':UNDEFINED
-undefined-variable:78:20:78:27:MyClass.incorrect_default_method:Undefined variable 'MyClass':UNDEFINED
-used-before-assignment:139:35:139:39:MyFourthClass.is_close:Using variable 'math' before assignment:HIGH
-used-before-assignment:152:20:152:28:VariableAnnotationsGuardedByTypeChecking:Using variable 'datetime' before assignment:HIGH
+undefined-variable:69:21:69:28:MyClass.incorrect_typing_method:Undefined variable 'MyClass':UNDEFINED
+undefined-variable:74:26:74:33:MyClass.incorrect_nested_typing_method:Undefined variable 'MyClass':UNDEFINED
+undefined-variable:79:20:79:27:MyClass.incorrect_default_method:Undefined variable 'MyClass':UNDEFINED
+used-before-assignment:140:35:140:39:MyFourthClass.is_close:Using variable 'math' before assignment:CONTROL_FLOW
+used-before-assignment:153:20:153:28:VariableAnnotationsGuardedByTypeChecking:Using variable 'datetime' before assignment:CONTROL_FLOW
diff --git a/tests/functional/u/useless/useless_parent_delegation.py b/tests/functional/u/useless/useless_parent_delegation.py
index ce645e31f..b742a4e94 100644
--- a/tests/functional/u/useless/useless_parent_delegation.py
+++ b/tests/functional/u/useless/useless_parent_delegation.py
@@ -312,7 +312,7 @@ class DecoratedList(MyList):
return super().__hash__()
-# Reported in https://github.com/PyCQA/pylint/issues/2270
+# Reported in https://github.com/pylint-dev/pylint/issues/2270
class Super:
def __init__(self, *args):
self.args = args
diff --git a/tests/functional/u/useless/useless_suppression.py b/tests/functional/u/useless/useless_suppression.py
index b5c681eef..627138b50 100644
--- a/tests/functional/u/useless/useless_suppression.py
+++ b/tests/functional/u/useless/useless_suppression.py
@@ -3,14 +3,14 @@
# pylint: disable=unused-import, wrong-import-order, wrong-import-position
# False positive for wrong-import-order
-# Reported in https://github.com/PyCQA/pylint/issues/2366
+# Reported in https://github.com/pylint-dev/pylint/issues/2366
from pylint import run_pylint
import astroid
# False-positive for 'line-too-long'
-# Reported in https://github.com/PyCQA/pylint/issues/4212
+# Reported in https://github.com/pylint-dev/pylint/issues/4212
VAR = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # pylint: disable=line-too-long
# False-positive for 'wrong-import-order'
-# Reported in https://github.com/PyCQA/pylint/issues/5219
+# Reported in https://github.com/pylint-dev/pylint/issues/5219
import os