Fixed -not option with no arguments bug (#1466)

This commit is contained in:
Kevin 2022-05-07 12:19:37 -07:00 committed by GitHub
parent 4dacd86bc3
commit 8458cdb06f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -243,10 +243,10 @@ def parse_args(args=[]):
reading.add_argument(
"-not",
dest="excluded",
nargs="?",
nargs=1,
default=[],
metavar="TAG",
action="append",
action="extend",
help="Exclude entries with this tag",
)

View file

@ -88,6 +88,12 @@ def test_end_date_alone():
assert expected == cli_as_dict("-to 2020-01-01")
def test_not_empty():
with pytest.raises(SystemExit) as wrapped_e:
cli_as_dict("-not")
assert wrapped_e.value.code == 2
def test_not_alone():
assert cli_as_dict("-not test") == expected_args(excluded=["test"])