Make win_id/count mutually exclusive for ArgInfo
This commit is contained in:
parent
35135c4b0d
commit
2370793f38
@ -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
|
||||
|
@ -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!"
|
||||
|
Loading…
Reference in New Issue
Block a user