From cac116b5d8c2b7f31ae39491802c4bd7cb71c254 2023-02-11 16:14:43 From: krassowski <5832902+krassowski@users.noreply.github.com> Date: 2023-02-11 16:14:43 Subject: [PATCH] Add test for no matching shortcut for modification --- diff --git a/IPython/terminal/tests/test_shortcuts.py b/IPython/terminal/tests/test_shortcuts.py index e3f6581..18c9dab 100644 --- a/IPython/terminal/tests/test_shortcuts.py +++ b/IPython/terminal/tests/test_shortcuts.py @@ -420,6 +420,17 @@ def test_add_shortcut_for_new_command(ipython_with_prompt): assert len(matched) == 0 +def test_modify_shortcut_failure(ipython_with_prompt): + with pytest.raises(ValueError, match="No shortcuts matching"): + ipython_with_prompt.shortcuts = [ + { + "command": "IPython:auto_match.skip_over", + "match_keys": ["x"], + "new_keys": ["y"], + } + ] + + def test_add_shortcut_for_existing_command(ipython_with_prompt): matched = find_bindings_by_command(skip_over) assert len(matched) == 5