Skip to content

Commit 7034e2e

Browse files
committed
add test for changes
1 parent 1cc6aad commit 7034e2e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Lib/test/test_argparse.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2934,6 +2934,19 @@ def test_alias_help(self):
29342934
3 3 help
29352935
"""))
29362936

2937+
def test_help_sets_default_description(self):
2938+
parser = argparse.ArgumentParser()
2939+
subparsers = parser.add_subparsers(dest="command")
2940+
2941+
sp1 = subparsers.add_parser("a", help="help a")
2942+
self.assertEqual(sp1.description, "help a")
2943+
2944+
sp2 = subparsers.add_parser("b", help="help b", description="explicit desc")
2945+
self.assertEqual(sp2.description, "explicit desc")
2946+
2947+
sp3 = subparsers.add_parser("c")
2948+
self.assertIsNone(sp3.description)
2949+
29372950
# ============
29382951
# Groups tests
29392952
# ============

0 commit comments

Comments
 (0)