Skip to content

Commit 750a4f8

Browse files
nelfinPierre-Sassoulas
authored andcommitted
Add regression test of invalid-sequence-index on __getitem__
Ref pylint-dev/astroid#927 (comment)
1 parent f7725b7 commit 750a4f8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# pylint: disable=missing-docstring,too-few-public-methods
2+
3+
class DynamicGetitem:
4+
def __getitem__(self, key):
5+
if key == 'attributes':
6+
return []
7+
return {'world': 123}
8+
9+
10+
ex = DynamicGetitem()
11+
a = ex['hello']['world'] # false-positive: invalid-sequence-index

0 commit comments

Comments
 (0)