Skip to content

Commit e4fb943

Browse files
fix up keymap creation
1 parent 3c94259 commit e4fb943

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pyrepl/keymap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def compile_keymap(keymap, empty=b''):
174174
r = {}
175175
import pprint
176176
for key, value in keymap.items():
177-
r.setdefault(key[0], {})[key[1:]] = value
177+
r.setdefault(key[:1], {})[key[1:]] = value
178178
for key, value in r.items():
179179
if empty in value:
180180
if len(value) != 1:

testing/test_keymap.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from pyrepl.keymap import compile_keymap
2+
3+
4+
def test_compile_keymap():
5+
k = compile_keymap({
6+
b'a': 'test',
7+
b'bc': 'test2',
8+
})
9+
10+
assert k == {b'a': 'test', b'b': { b'c': 'test2'}}

0 commit comments

Comments
 (0)