Skip to content

Commit 04e96c2

Browse files
committed
Fixed tests in test_dynamic_complete_style.py.
1 parent b880914 commit 04e96c2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/test_dynamic_complete_style.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from prompt_toolkit.shortcuts import CompleteStyle
33

44
import cmd2
5+
from cmd2 import Completions
56

67

78
class AutoStyleApp(cmd2.Cmd):
@@ -11,16 +12,18 @@ def __init__(self):
1112
def do_foo(self, args):
1213
pass
1314

14-
def complete_foo(self, text, line, begidx, endidx):
15+
def complete_foo(self, text, line, begidx, endidx) -> Completions:
1516
# Return 10 items
16-
return [f'item{i}' for i in range(10) if f'item{i}'.startswith(text)]
17+
items = [f'item{i}' for i in range(10) if f'item{i}'.startswith(text)]
18+
return Completions.from_values(items)
1719

1820
def do_bar(self, args):
1921
pass
2022

21-
def complete_bar(self, text, line, begidx, endidx):
23+
def complete_bar(self, text, line, begidx, endidx) -> Completions:
2224
# Return 5 items
23-
return [f'item{i}' for i in range(5) if f'item{i}'.startswith(text)]
25+
items = [f'item{i}' for i in range(5) if f'item{i}'.startswith(text)]
26+
return Completions.from_values(items)
2427

2528

2629
@pytest.fixture

0 commit comments

Comments
 (0)