diff options
author | Florian Bruhin <me@the-compiler.org> | 2019-10-07 13:54:44 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-11-22 15:23:24 +0100 |
commit | fbb8f9cb9f44b27595916c1869177c6e1388b43c (patch) | |
tree | 4690726a4b4dde89fb942e108864fdf5e8fb82a0 | |
parent | 506eeb72776ef95827c1dfa3ed0aa55897574952 (diff) | |
download | qutebrowser-fbb8f9cb9f44b27595916c1869177c6e1388b43c.tar.gz qutebrowser-fbb8f9cb9f44b27595916c1869177c6e1388b43c.zip |
Add missing test for config.bind(..., None)
(cherry picked from commit 1ed80cd3533eca636e3279515160ce03d0448d09)
-rw-r--r-- | tests/unit/config/test_configfiles.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/unit/config/test_configfiles.py b/tests/unit/config/test_configfiles.py index a21d6787a..833e1e4fd 100644 --- a/tests/unit/config/test_configfiles.py +++ b/tests/unit/config/test_configfiles.py @@ -737,13 +737,27 @@ class TestConfigPy: expected = {'normal': {'H': 'message-info back'}} assert config.instance.get_obj('bindings.commands') == expected - def test_bind_none(self, confpy): + def test_bind_nop(self, confpy): confpy.write("c.bindings.commands = None", "config.bind(',x', 'nop')") confpy.read() expected = {'normal': {',x': 'nop'}} assert config.instance.get_obj('bindings.commands') == expected + def test_bind_none(self, confpy): + confpy.write("config.bind('<Ctrl+q>', None)") + with pytest.raises(configexc.ConfigFileErrors) as excinfo: + confpy.read() + + expected = {'normal': {'<Ctrl+q>': None}} + assert config.instance.get_obj('bindings.commands') == expected + + msg = ("While unbinding '<Ctrl+q>': Unbinding commands with " + "config.bind('<Ctrl+q>', None) is deprecated. Use " + "config.unbind('<Ctrl+q>') instead.") + assert len(excinfo.value.errors) == 1 + assert str(excinfo.value.errors[0]) == msg + @pytest.mark.parametrize('line, key, mode', [ ('config.unbind("o")', 'o', 'normal'), ('config.unbind("y", mode="yesno")', 'y', 'yesno'), |