Fix test_modeparsers
This commit is contained in:
parent
911b2daebf
commit
1ba61bbcbe
@ -25,7 +25,7 @@ from PyQt5.QtCore import Qt
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from qutebrowser.keyinput import modeparsers
|
from qutebrowser.keyinput import modeparsers, keyutils
|
||||||
|
|
||||||
|
|
||||||
class TestsNormalKeyParser:
|
class TestsNormalKeyParser:
|
||||||
@ -58,7 +58,7 @@ class TestsNormalKeyParser:
|
|||||||
keyparser.handle(fake_keyevent_factory(Qt.Key_A, text='a'))
|
keyparser.handle(fake_keyevent_factory(Qt.Key_A, text='a'))
|
||||||
keyparser.execute.assert_called_with(
|
keyparser.execute.assert_called_with(
|
||||||
'message-info ba', keyparser.Type.chain, None)
|
'message-info ba', keyparser.Type.chain, None)
|
||||||
assert keyparser._keystring == ''
|
assert not keyparser._sequence
|
||||||
|
|
||||||
def test_partial_keychain_timeout(self, keyparser, config_stub,
|
def test_partial_keychain_timeout(self, keyparser, config_stub,
|
||||||
fake_keyevent_factory):
|
fake_keyevent_factory):
|
||||||
@ -74,11 +74,11 @@ class TestsNormalKeyParser:
|
|||||||
assert timer.isActive()
|
assert timer.isActive()
|
||||||
|
|
||||||
assert not keyparser.execute.called
|
assert not keyparser.execute.called
|
||||||
assert keyparser._keystring == 'b'
|
assert keyparser._sequence == keyutils.KeySequence.parse('b')
|
||||||
# Now simulate a timeout and check the keystring has been cleared.
|
# Now simulate a timeout and check the keystring has been cleared.
|
||||||
keystring_updated_mock = mock.Mock()
|
keystring_updated_mock = mock.Mock()
|
||||||
keyparser.keystring_updated.connect(keystring_updated_mock)
|
keyparser.keystring_updated.connect(keystring_updated_mock)
|
||||||
timer.timeout.emit()
|
timer.timeout.emit()
|
||||||
assert not keyparser.execute.called
|
assert not keyparser.execute.called
|
||||||
assert keyparser._keystring == ''
|
assert not keyparser._sequence
|
||||||
keystring_updated_mock.assert_called_once_with('')
|
keystring_updated_mock.assert_called_once_with('')
|
||||||
|
Loading…
Reference in New Issue
Block a user