From c24b143028253e39414259787a9e8632e78bc77d Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 1 Jul 2021 20:21:44 +0200 Subject: [unsubscriptable-object] Add functional tests for issue #2072 --- tests/functional/u/unsubscriptable_value.py | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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:] -- cgit v1.2.1