diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-07-01 20:21:44 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-08-26 15:32:46 +0200 |
commit | c24b143028253e39414259787a9e8632e78bc77d (patch) | |
tree | bb9d0084057ffb978858ad5baaf0df6606bce790 | |
parent | 646fef2339b576a596eb8a026393a17da31b7b97 (diff) | |
download | pylint-git-issue-2072.tar.gz |
[unsubscriptable-object] Add functional tests for issue #2072issue-2072
-rw-r--r-- | tests/functional/u/unsubscriptable_value.py | 30 |
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:] |