| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 404e5c7 commit 599cfea
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -160,17 +160,17 @@ def format(self, word): | |||
| 160 | 160 | return self._completers[0].format(word) | |
| 161 | 161 | ||
| 162 | 162 | def matches(self, cursor_offset, line, **kwargs): | |
| 163 | + return_value = None | ||
| 163 | 164 | all_matches = set() | |
| 164 | 165 | for completer in self._completers: | |
| 165 | - # these have to be explicitely listed to deal with the different | ||
| 166 | - # signatures of various matches() methods of completers | ||
| 167 | 166 | matches = completer.matches(cursor_offset=cursor_offset, | |
| 168 | 167 | line=line, | |
| 169 | 168 | **kwargs) | |
| 170 | 169 | if matches is not None: | |
| 171 | 170 | all_matches.update(matches) | |
| 171 | + return_value = all_matches | ||
| 172 | 172 | ||
| 173 | - return all_matches | ||
| 173 | + return return_value | ||
| 174 | 174 | ||
| 175 | 175 | ||
| 176 | 176 | class ImportCompletion(BaseCompletionType): | |
@@ -634,11 +634,11 @@ def get_default_completer(mode=SIMPLE): | |||
| 634 | 634 | FilenameCompletion(mode=mode), | |
| 635 | 635 | MagicMethodCompletion(mode=mode), | |
| 636 | 636 | MultilineJediCompletion(mode=mode), | |
| 637 | - GlobalCompletion(mode=mode), | ||
| 638 | - ArrayItemMembersCompletion(mode=mode), | ||
| 639 | - CumulativeCompleter((AttrCompletion(mode=mode), | ||
| 637 | + CumulativeCompleter((GlobalCompletion(mode=mode), | ||
| 640 | 638 | ParameterNameCompletion(mode=mode)), | |
| 641 | - mode=mode) | ||
| 639 | + mode=mode), | ||
| 640 | + ArrayItemMembersCompletion(mode=mode), | ||
| 641 | + AttrCompletion(mode=mode), | ||
| 642 | 642 | ) | |
| 643 | 643 | ||
| 644 | 644 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -107,10 +107,10 @@ def test_one_empty_completer_returns_empty(self): | |||
| 107 | 107 | cumulative = autocomplete.CumulativeCompleter([a]) | |
| 108 | 108 | self.assertEqual(cumulative.matches(3, 'abc'), set()) | |
| 109 | 109 | ||
| 110 | - def test_one_none_completer_returns_empty(self): | ||
| 110 | + def test_one_none_completer_returns_none(self): | ||
| 111 | 111 | a = self.completer(None) | |
| 112 | 112 | cumulative = autocomplete.CumulativeCompleter([a]) | |
| 113 | - self.assertEqual(cumulative.matches(3, 'abc'), set()) | ||
| 113 | + self.assertEqual(cumulative.matches(3, 'abc'), None) | ||
| 114 | 114 | ||
| 115 | 115 | def test_two_completers_get_both(self): | |
| 116 | 116 | a = self.completer(['a']) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -383,7 +383,7 @@ def test_fuzzy_attribute_complete(self): | |||
| 383 | 383 | self.assertTrue(hasattr(self.repl.matches_iter, 'matches')) | |
| 384 | 384 | self.assertEqual(self.repl.matches_iter.matches, ['Foo.bar']) | |
| 385 | 385 | ||
| 386 | - # 3. Edge Cases | ||
| 386 | + # 3. Edge cases | ||
| 387 | 387 | def test_updating_namespace_complete(self): | |
| 388 | 388 | self.repl = FakeRepl({'autocomplete_mode': autocomplete.SIMPLE}) | |
| 389 | 389 | self.set_input_line("foo") | |
@@ -400,6 +400,19 @@ def test_file_should_not_appear_in_complete(self): | |||
| 400 | 400 | self.assertTrue(hasattr(self.repl.matches_iter, 'matches')) | |
| 401 | 401 | self.assertNotIn('__file__', self.repl.matches_iter.matches) | |
| 402 | 402 | ||
| 403 | + # 4. Parameter names | ||
| 404 | + def test_paremeter_name_completion(self): | ||
| 405 | + self.repl = FakeRepl({'autocomplete_mode': autocomplete.SIMPLE}) | ||
| 406 | + self.set_input_line("foo(ab") | ||
| 407 | + | ||
| 408 | + code = "def foo(abc=1, abd=2, xyz=3):\n\tpass\n" | ||
| 409 | + for line in code.split("\n"): | ||
| 410 | + self.repl.push(line) | ||
| 411 | + | ||
| 412 | + self.assertTrue(self.repl.complete()) | ||
| 413 | + self.assertTrue(hasattr(self.repl.matches_iter, 'matches')) | ||
| 414 | + self.assertEqual(self.repl.matches_iter.matches, ['abc=', 'abd=', 'abs(']) | ||
| 415 | + | ||
| 403 | 416 | ||
| 404 | 417 | class TestCliRepl(unittest.TestCase): | |
| 405 | 418 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments