|
1 | 1 | fromcollectionsimportnamedtuple |
| 2 | +importinspect |
| 3 | +frombpython._py3compatimportpy3 |
2 | 4 |
|
3 | 5 | try: |
4 | 6 | importunittest2asunittest |
@@ -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 | +classTestParameterNameCompletion(unittest.TestCase): |
| 278 | +deftest_set_of_params_returns_when_matches_found(self): |
| 279 | +deffunc(apple,apricot,banana,carrot): |
| 280 | +pass |
| 281 | +ifpy3: |
| 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='])) |