Skip to content

Commit

Permalink
Tweak the test for changing actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Feb 29, 2024
1 parent b2b8e05 commit fa177ff
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions core/tests/command/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,29 @@ def test_create():


def test_change_action():
def local():
assert False

"""A command's action can be changed to another handler"""
cmd = toga.Command(local, "Test command")
action1 = Mock()

cmd = toga.Command(action1, "Test command")

assert cmd.text == "Test command"
assert cmd.shortcut is None
assert cmd.tooltip is None
assert cmd.group == toga.Group.COMMANDS
assert cmd.section == 0
assert cmd.order == 0
assert cmd.action._raw is not None
assert cmd.action._raw == action1

# Change the action to a something new
action2 = Mock()
cmd.action = action2

assert cmd.action._raw == action2

# Clear the action
cmd.action = None
assert cmd.action._raw is None

assert (
repr(cmd)
== "<Command text='Test command' group=<Group text='Commands' order=30> section=0 order=0>"
)


def test_create_explicit(app):
"""A command can be created with explicit arguments"""
Expand Down

0 comments on commit fa177ff

Please sign in to comment.