From 52c280ec12c2f4c5f6e565dd599c4578d4870e8b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 5 Mar 2018 15:33:56 +0100 Subject: [PATCH] Add unit tests for BaseKeyParser.handle with dry_run=True --- tests/unit/keyinput/test_basekeyparser.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/keyinput/test_basekeyparser.py b/tests/unit/keyinput/test_basekeyparser.py index 9ed996922..6fd12d92e 100644 --- a/tests/unit/keyinput/test_basekeyparser.py +++ b/tests/unit/keyinput/test_basekeyparser.py @@ -172,6 +172,16 @@ class TestHandle: assert not keyparser.execute.called assert not keyparser._sequence + def test_dry_run(self, fake_keyevent, keyparser): + keyparser.handle(fake_keyevent(Qt.Key_B)) + keyparser.handle(fake_keyevent(Qt.Key_A), dry_run=True) + assert not keyparser.execute.called + assert keyparser._sequence + + def test_dry_run_count(self, fake_keyevent, keyparser): + keyparser.handle(fake_keyevent(Qt.Key_1), dry_run=True) + assert not keyparser._count + def test_valid_keychain(self, handle_text, keyparser): # Press 'x' which is ignored because of no match handle_text(Qt.Key_X,