| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,6 @@ | |||
| 1 | 1 | from collections import namedtuple | |
| 2 | + import inspect | ||
| 3 | + from bpython._py3compat import py3 | ||
| 2 | 4 | ||
| 3 | 5 | try: | |
| 4 | 6 | import unittest2 as unittest | |
@@ -270,3 +272,19 @@ def function(): | |||
| 270 | 272 | self.assertEqual(self.com.matches(8, 'function', | |
| 271 | 273 | locals_={'function': function}), | |
| 272 | 274 | set(('function(', ))) | |
| 275 | + | ||
| 276 | + | ||
| 277 | + class TestParameterNameCompletion(unittest.TestCase): | ||
| 278 | + def test_set_of_params_returns_when_matches_found(self): | ||
| 279 | + def func(apple, apricot, banana, carrot): | ||
| 280 | + pass | ||
| 281 | + if py3: | ||
| 282 | + argspec = list(inspect.getfullargspec(func)) | ||
| 283 | + else: | ||
| 284 | + argspec = list(inspect.getargspec(func)) | ||
| 285 | + | ||
| 286 | + argspec = ["func", argspec, False] | ||
| 287 | + com=autocomplete.ParameterNameCompletion() | ||
| 288 | + self.assertSetEqual(com.matches(1, "a", argspec=argspec), set(['apple=', 'apricot='])) | ||
| 289 | + self.assertSetEqual(com.matches(2, "ba", argspec=argspec), set(['banana='])) | ||
| 290 | + self.assertSetEqual(com.matches(3, "car", argspec=argspec), set(['carrot='])) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments