def test_modifierbuttons_empty():
    # Tests the initial state of a ModifierButtons object.
    btns = ModifierButtons()
    assert btns == ModifierButtons(btns)
    assert btns != ModifierButtons()
    assert btns.matches(ModifierButtons())
    assert not btns.is_down("alt")
    assert not btns.is_any_down()
    assert not btns.has_button("alt")
    assert btns.get_prefix() == ""
    assert btns.get_num_buttons() == 0
    assert len(btns.buttons) == 0
def test_modifierbuttons_state():
    btns = ModifierButtons()
    btns.add_button("alt")
    btns.add_button("shift")
    btns.add_button("control")
    assert not btns.is_any_down()

    # Not tracked
    btns.button_down("enter")
    assert not btns.is_any_down()

    # Tracked
    btns.button_down("shift")
    assert btns.is_any_down()
    assert not btns.is_down(0)
    assert btns.is_down(1)
    assert not btns.is_down(2)

    btns.button_up("shift")
    assert not btns.is_any_down()
    assert not btns.is_down(0)
    assert not btns.is_down(1)
    assert not btns.is_down(2)

    btns.button_down("alt")
    btns.button_down("shift")
    assert btns.is_any_down()
    assert btns.is_down(0)
    assert btns.is_down(1)
    assert not btns.is_down(2)

    btns.all_buttons_up()
    assert not btns.is_any_down()
    assert not btns.is_down(0)
    assert not btns.is_down(1)
    assert not btns.is_down(2)