mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-22 05:11:25 +08:00
reduce/remove getitem side effects, tests for #297
This commit is contained in:
@@ -71,3 +71,12 @@ class TestInterpreterAPI(TestCase):
|
|||||||
self.check_interpreter_complete('getattr(Foo, baz[1:-1]).append',
|
self.check_interpreter_complete('getattr(Foo, baz[1:-1]).append',
|
||||||
locals(),
|
locals(),
|
||||||
['append'])
|
['append'])
|
||||||
|
|
||||||
|
def test_getitem_side_effects(self):
|
||||||
|
class Foo():
|
||||||
|
def __getitem__(self, index):
|
||||||
|
# possible side effects here, should therefore not call this.
|
||||||
|
return index
|
||||||
|
|
||||||
|
foo = Foo()
|
||||||
|
self.check_interpreter_complete('foo[0].', locals(), [])
|
||||||
|
|||||||
Reference in New Issue
Block a user