From 9c709b8fef139fac8a2ec0ab38e621966b703198 Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Tue, 6 Feb 2024 15:09:13 -0600 Subject: [PATCH] tests: integration test for trailing underscores --- tests/test_integration.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_integration.py b/tests/test_integration.py index f863386..21e7cfc 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -594,6 +594,19 @@ def cmd(a_b): assert run(parser, "hello").out == "hello\n" +@pytest.mark.xfail +def test_trailing_underscore_keys(): + """One trailing underscore is ignored in function args.""" + + def cmd(*, a, b_, c__): + return f"a='{a}' b_='{b_}' c__='{c__}'" + + parser = DebugArghParser() + parser.set_default_command(cmd) + + assert run(parser, "--a x --b y --c- z").out == "a='x' b_='y' c__='z'\n" + + @mock.patch("argh.assembling.COMPLETION_ENABLED", True) def test_custom_argument_completer(): "Issue #33: Enable custom per-argument shell completion"