Skip to content

Commit 9579c06

Browse files
Test attribute completion
1 parent 1eaac2c commit 9579c06

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

bpython/test/test_autocomplete.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,16 @@ def test_obj_that_does_not_allow_conversion_to_bool(self):
175175
com = autocomplete.DictKeyCompletion()
176176
local={'mNumPy':MockNumPy(),}
177177
self.assertSetEqual(com.matches(7,"mNumPy[" , local), set())
178+
179+
class Foo(object):
180+
a = 10
181+
def __init__(self):
182+
self.b = 20
183+
def method(self, x):
184+
pass
185+
186+
class TestAttrCompletion(unittest.TestCase):
187+
188+
def test_att_matches_found_on_instance(self):
189+
com = autocomplete.AttrCompletion()
190+
self.assertSetEqual(com.matches(2, 'a.', {'a': Foo()}), set(['a.method', 'a.a', 'a.b']))

0 commit comments

Comments
 (0)