Skip to content

Commit

Permalink
Miscellanous easy coverage wins.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Jun 29, 2023
1 parent 9d052db commit c12ed3c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion core/src/toga/constants/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from travertino.constants import * # noqa: F401, F403
from travertino.constants import * # noqa: F401, F403 pragma: no cover
2 changes: 1 addition & 1 deletion core/src/toga/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,4 @@ def __add__(self, other):

def __radd__(self, other):
"""Same as add."""
return self + other
return other + self.value
11 changes: 0 additions & 11 deletions core/tests/test_key.py

This file was deleted.

21 changes: 21 additions & 0 deletions core/tests/test_keys.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from toga.keys import Key


def test_is_printable():
"Key printability can be checked"
assert not Key.is_printable(Key.SHIFT)
assert Key.is_printable(Key.LESS_THAN)
assert Key.is_printable(Key.GREATER_THAN)
assert Key.is_printable(Key.NUMPAD_0)


def test_modifiers():
"Keys can be added with modifiers"
# Mod + Key
assert Key.MOD_1 + Key.A == "<mod 1>a"

# Multiple modifiers can be used
assert Key.MOD_1 + Key.SHIFT + Key.A == "<mod 1><shift>a"

# Bare characters can be used
assert Key.MOD_1 + "a" == "<mod 1>a"

0 comments on commit c12ed3c

Please sign in to comment.