Skip to content

Commit a406b17

Browse files
committed
Add regression test of invalid-sequence-index on __getitem__
Ref pylint-dev/astroid#927 (comment)
1 parent a16fbfb commit a406b17

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
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)