Skip to content

Commit 5b6e61e

Browse files
committed
Merge remote-tracking branch 'maryakins/autocomplete-params'
Conflicts: bpython/test/test_autocomplete.py
2 parents 07e18d7 + 4bacc37 commit 5b6e61e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bpython/test/test_autocomplete.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from collections import namedtuple
2+
import inspect
3+
from bpython._py3compat import py3
24

35
try:
46
import unittest2 as unittest
@@ -270,3 +272,19 @@ def function():
270272
self.assertEqual(self.com.matches(8, 'function',
271273
locals_={'function': function}),
272274
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=']))

0 commit comments

Comments
 (0)