summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-07-01 20:21:44 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2022-08-26 15:32:46 +0200
commitc24b143028253e39414259787a9e8632e78bc77d (patch)
treebb9d0084057ffb978858ad5baaf0df6606bce790
parent646fef2339b576a596eb8a026393a17da31b7b97 (diff)
downloadpylint-git-issue-2072.tar.gz
[unsubscriptable-object] Add functional tests for issue #2072issue-2072
-rw-r--r--tests/functional/u/unsubscriptable_value.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/functional/u/unsubscriptable_value.py b/tests/functional/u/unsubscriptable_value.py
index 2a40d647f..ee5884be9 100644
--- a/tests/functional/u/unsubscriptable_value.py
+++ b/tests/functional/u/unsubscriptable_value.py
@@ -124,3 +124,33 @@ def test_one(param):
"""Should complain about var_one[0], but doesn't"""
var_one = return_an_int(param)
return var_one[0] # [unsubscriptable-object]
+
+
+def test_1():
+ """Regression test for #2072"""
+ a = None
+ for i in range(1, 5):
+ if i % 2:
+ a = "foo"
+ else:
+ a = a[1:]
+
+
+def test_2():
+ """Regression test for #2072"""
+ a = None
+ for i in range(1, 5):
+ if i % 2:
+ a = "foo"
+ if not i % 2:
+ a = a[1:]
+
+
+def test_3():
+ """Regression test for #2072"""
+ a = None
+ for i in range(1, 5):
+ if i % 2:
+ a = "foo"
+ elif not i % 2:
+ a = a[1:]