diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index 9048ea4e0..802d4a4bb 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -40,6 +40,8 @@ class ArgInfo: """Information about an argument.""" def __init__(self, win_id=False, count=False, flag=None): + if win_id and count: + raise TypeError("Argument marked as both count/win_id!") self.win_id = win_id self.count = count self.flag = flag diff --git a/tests/unit/commands/test_cmdutils.py b/tests/unit/commands/test_cmdutils.py index 6a4bc829b..1fa47d556 100644 --- a/tests/unit/commands/test_cmdutils.py +++ b/tests/unit/commands/test_cmdutils.py @@ -294,3 +294,12 @@ class TestArgument: "@cmdutils.register for fun!") assert str(excinfo.value) == text + + def test_count_and_win_id_same_arg(self): + with pytest.raises(TypeError) as excinfo: + @cmdutils.argument('arg', count=True, win_id=True) + def fun(arg=0): + """Blah.""" + pass + + assert str(excinfo.value) == "Argument marked as both count/win_id!"