Skip to content

Commit b454048

Browse files
committed
Test global completion with modified keyword list
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent ac3ef20 commit b454048

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

bpython/test/test_autocomplete.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from collections import namedtuple
44
import inspect
5+
import keyword
56
from bpython._py3compat import py3
67

78
try:
@@ -284,6 +285,14 @@ def test_ignores_nonascii_encodable(self):
284285
self.assertSetEqual(self.com.matches(3, 'abc', locals_={'abcß': 10}),
285286
set())
286287

288+
def test_mock_kwlist(self):
289+
with mock.patch.object(keyword, 'kwlist', new=['abcd']):
290+
self.assertSetEqual(self.com.matches(3, 'abc', locals_={}), set())
291+
292+
def test_mock_kwlist_non_ascii(self):
293+
with mock.patch.object(keyword, 'kwlist', new=['abcß']):
294+
self.assertSetEqual(self.com.matches(3, 'abc', locals_={}), set())
295+
287296

288297
class TestParameterNameCompletion(unittest.TestCase):
289298
def test_set_of_params_returns_when_matches_found(self):

0 commit comments

Comments
 (0)