|
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
|
@@ -256,3 +258,21 @@ def test_completions_starting_with_different_cases(self):
|
256 | 258 | 2, ' a', 'class Foo:\n a', ['adsf'],
|
257 | 259 | [Comp('Abc', 'bc'), Comp('ade', 'de')])
|
258 | 260 | self.assertSetEqual(matches, set(['ade']))
|
| 261 | + |
| 262 | + |
| 263 | +class TestParameterNameCompletion(unittest.TestCase): |
| 264 | + def test_set_of_params_returns_when_matches_found(self): |
| 265 | + def func(apple, apricot, banana, carrot): |
| 266 | + pass |
| 267 | + if py3: |
| 268 | + argspec = list(inspect.getfullargspec(func)) |
| 269 | + else: |
| 270 | + argspec = list(inspect.getargspec(func)) |
| 271 | + |
| 272 | + argspec = ["func", argspec, False] |
| 273 | + com=autocomplete.ParameterNameCompletion() |
| 274 | + self.assertSetEqual(com.matches(1, "a", argspec=argspec), set(['apple=', 'apricot='])) |
| 275 | + self.assertSetEqual(com.matches(2, "ba", argspec=argspec), set(['banana='])) |
| 276 | + self.assertSetEqual(com.matches(3, "car", argspec=argspec), set(['carrot='])) |
| 277 | + |
| 278 | + |
0 commit comments