Skip to content

Commit 4bacc37

Browse files
author
Mary Mokuolu
committed
Add test for param completion
1 parent 1451c2c commit 4bacc37

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

bpython/test/test_autocomplete.py

Lines changed: 20 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
@@ -256,3 +258,21 @@ def test_completions_starting_with_different_cases(self):
256258
2, ' a', 'class Foo:\n a', ['adsf'],
257259
[Comp('Abc', 'bc'), Comp('ade', 'de')])
258260
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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy