Skip to content

Commit 9b6aa7b

Browse files
enable attribute completion within function call
1 parent 4e92abd commit 9b6aa7b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

bpython/autocomplete.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def matches(self, cursor_offset, line, **kwargs):
471471
if (self.method_match(word, n, r.word) and
472472
word != "__builtins__"):
473473
matches.add(_callable_postfix(val, word))
474-
return matches
474+
return matches if matches else None
475475

476476
def locate(self, current_offset, line):
477477
return lineparts.current_single_word(current_offset, line)
@@ -496,7 +496,7 @@ def matches(self, cursor_offset, line, **kwargs):
496496
if py3:
497497
matches.update(name + '=' for name in argspec[1][4]
498498
if name.startswith(r.word))
499-
return matches
499+
return matches if matches else None
500500

501501
def locate(self, current_offset, line):
502502
return lineparts.current_word(current_offset, line)

bpython/test/test_autocomplete.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,16 @@ def test_completions_are_unicode(self):
383383

384384
@unittest.skipIf(py3, "in Python 3 invalid identifiers are passed through")
385385
def test_ignores_nonascii_encodable(self):
386-
self.assertSetEqual(self.com.matches(3, 'abc', locals_={'abcß': 10}),
387-
set())
386+
self.assertEqual(self.com.matches(3, 'abc', locals_={'abcß': 10}),
387+
None)
388388

389389
def test_mock_kwlist(self):
390390
with mock.patch.object(keyword, 'kwlist', new=['abcd']):
391-
self.assertSetEqual(self.com.matches(3, 'abc', locals_={}), set())
391+
self.assertEqual(self.com.matches(3, 'abc', locals_={}), None)
392392

393393
def test_mock_kwlist_non_ascii(self):
394394
with mock.patch.object(keyword, 'kwlist', new=['abcß']):
395-
self.assertSetEqual(self.com.matches(3, 'abc', locals_={}), set())
395+
self.assertEqual(self.com.matches(3, 'abc', locals_={}), None)
396396

397397

398398
class TestParameterNameCompletion(unittest.TestCase):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy