summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2019-09-13 10:50:14 +0200
committerFlorian Bruhin <me@the-compiler.org>2019-09-13 13:12:54 +0200
commitbe31f1b6e029c259757eb66a79ce16750c076f60 (patch)
tree412f141b647e9147526df1fcb1445254c6ce4c8d
parent0b3087b613a2eec6ef2fbfb170c38968b29a10de (diff)
downloadqutebrowser-be31f1b6e029c259757eb66a79ce16750c076f60.tar.gz
qutebrowser-be31f1b6e029c259757eb66a79ce16750c076f60.zip
Fix coverage
-rw-r--r--.coveragerc1
-rw-r--r--tests/unit/keyinput/test_keyutils.py23
2 files changed, 24 insertions, 0 deletions
diff --git a/.coveragerc b/.coveragerc
index 6f166bed2..2ef20dd12 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -15,6 +15,7 @@ exclude_lines =
raise utils\.Unreachable
if __name__ == ["']__main__["']:
if typing.TYPE_CHECKING:
+ \.\.\.
[xml]
output=coverage.xml
diff --git a/tests/unit/keyinput/test_keyutils.py b/tests/unit/keyinput/test_keyutils.py
index 79d1d3735..e65287e2c 100644
--- a/tests/unit/keyinput/test_keyutils.py
+++ b/tests/unit/keyinput/test_keyutils.py
@@ -173,6 +173,21 @@ def test_key_info_str(key, modifiers, expected):
assert str(keyutils.KeyInfo(key, modifiers)) == expected
+@pytest.mark.parametrize('info1, info2, equal', [
+ (keyutils.KeyInfo(Qt.Key_A, Qt.NoModifier),
+ keyutils.KeyInfo(Qt.Key_A, Qt.NoModifier),
+ True),
+ (keyutils.KeyInfo(Qt.Key_A, Qt.NoModifier),
+ keyutils.KeyInfo(Qt.Key_B, Qt.NoModifier),
+ False),
+ (keyutils.KeyInfo(Qt.Key_A, Qt.NoModifier),
+ keyutils.KeyInfo(Qt.Key_B, Qt.ControlModifier),
+ False),
+])
+def test_hash(info1, info2, equal):
+ assert (hash(info1) == hash(info2)) == equal
+
+
@pytest.mark.parametrize('key, modifiers, text, expected', [
(0xd83c, Qt.NoModifier, '🏻', '<🏻>'),
(0xd867, Qt.NoModifier, '𩷶', '<𩷶>'),
@@ -316,6 +331,14 @@ class TestKeySequence:
}
assert opposite[op](seq1, seq2) != result
+ @pytest.mark.parametrize('op, result', [
+ (operator.eq, False),
+ (operator.ne, True),
+ ])
+ def test_operators_other_type(self, op, result):
+ seq = keyutils.KeySequence.parse('a')
+ assert op(seq, 'x') == result
+
@pytest.mark.parametrize('seq1, seq2, equal', [
('a', 'a', True),
('a', 'A', False),