From 17345b6e789589acfd6044ad10176e109a78316e Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 7 Apr 2014 16:06:07 +0200 Subject: [PATCH] reduce/remove getitem side effects, tests for #297 --- test/test_api/test_interpreter.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_api/test_interpreter.py b/test/test_api/test_interpreter.py index ff9ef2de..36d85ecb 100644 --- a/test/test_api/test_interpreter.py +++ b/test/test_api/test_interpreter.py @@ -71,3 +71,12 @@ class TestInterpreterAPI(TestCase): self.check_interpreter_complete('getattr(Foo, baz[1:-1]).append', locals(), ['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(), [])