diff options
author | Dani Alcala <112832187+clavedeluna@users.noreply.github.com> | 2022-09-23 16:11:37 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-23 21:11:37 +0200 |
commit | ca6648a909a7c583cc6c210bcaa126b4f6fb1f3b (patch) | |
tree | 3c2b6b631226b3b76e5befaa900520341bd845fa /tests/functional/n | |
parent | b418a7f2a4e6c5960bb8fd05d78412ca46c47471 (diff) | |
download | pylint-git-ca6648a909a7c583cc6c210bcaa126b4f6fb1f3b.tar.gz |
Fix false negative ``no-member`` when the code was a `manual` augmented assignments (#7509)
Diffstat (limited to 'tests/functional/n')
-rw-r--r-- | tests/functional/n/no/no_member_augassign.py | 25 | ||||
-rw-r--r-- | tests/functional/n/no/no_member_augassign.txt | 4 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/functional/n/no/no_member_augassign.py b/tests/functional/n/no/no_member_augassign.py new file mode 100644 index 000000000..f01567597 --- /dev/null +++ b/tests/functional/n/no/no_member_augassign.py @@ -0,0 +1,25 @@ +"""Tests for no-member in relation to AugAssign operations.""" +# pylint: disable=missing-module-docstring, too-few-public-methods, missing-class-docstring, invalid-name, consider-using-augmented-assign + +# Test for: https://github.com/PyCQA/pylint/issues/4562 +class A: + value: int + +obj_a = A() +obj_a.value += 1 # [no-member] + + +class B: + value: int + +obj_b = B() +obj_b.value = 1 + obj_b.value # [no-member] + + +class C: + value: int + + +obj_c = C() +obj_c.value += 1 # [no-member] +obj_c.value = 1 + obj_c.value # [no-member] diff --git a/tests/functional/n/no/no_member_augassign.txt b/tests/functional/n/no/no_member_augassign.txt new file mode 100644 index 000000000..68abf0b93 --- /dev/null +++ b/tests/functional/n/no/no_member_augassign.txt @@ -0,0 +1,4 @@ +no-member:9:0:9:11::Instance of 'A' has no 'value' member:INFERENCE +no-member:16:18:16:29::Instance of 'B' has no 'value' member:INFERENCE +no-member:24:0:24:11::Instance of 'C' has no 'value' member:INFERENCE +no-member:25:18:25:29::Instance of 'C' has no 'value' member:INFERENCE |