mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-10 07:41:51 +08:00
Use different Foo classes to avoid confusion around which class is used where.
This commit is contained in:
@@ -130,31 +130,31 @@ def test_list():
|
|||||||
|
|
||||||
|
|
||||||
def test_slice():
|
def test_slice():
|
||||||
class Foo():
|
class Foo1():
|
||||||
bar = []
|
bar = []
|
||||||
baz = 'xbarx'
|
baz = 'xbarx'
|
||||||
_assert_interpreter_complete('getattr(Foo, baz[1:-1]).append',
|
_assert_interpreter_complete('getattr(Foo1, baz[1:-1]).append',
|
||||||
locals(),
|
locals(),
|
||||||
['append'])
|
['append'])
|
||||||
|
|
||||||
|
|
||||||
def test_getitem_side_effects():
|
def test_getitem_side_effects():
|
||||||
class Foo():
|
class Foo2():
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
# possible side effects here, should therefore not call this.
|
# possible side effects here, should therefore not call this.
|
||||||
return index
|
return index
|
||||||
|
|
||||||
foo = Foo()
|
foo = Foo2()
|
||||||
_assert_interpreter_complete('foo[0].', locals(), [])
|
_assert_interpreter_complete('foo[0].', locals(), [])
|
||||||
|
|
||||||
|
|
||||||
def test_property_error():
|
def test_property_error():
|
||||||
class Foo():
|
class Foo3():
|
||||||
@property
|
@property
|
||||||
def bar(self):
|
def bar(self):
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
foo = Foo()
|
foo = Foo3()
|
||||||
_assert_interpreter_complete('foo.bar', locals(), ['bar'])
|
_assert_interpreter_complete('foo.bar', locals(), ['bar'])
|
||||||
_assert_interpreter_complete('foo.bar.baz', locals(), [])
|
_assert_interpreter_complete('foo.bar.baz', locals(), [])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user