Skip to content

Commit a375aa5

Browse files
committed
Add unit test to verify positionals are required
Ensure that under the "positional arguments" section in the help text, positional arguments are noted as "required".
1 parent 5746e7f commit a375aa5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_actions.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,17 @@ def configure(self):
211211
args = ExtendListIntTap().parse_args('--arg 1 2 --arg 3 --arg 4 5'.split())
212212
self.assertEqual(args.arg, [0, 1, 2, 3, 4, 5])
213213

214+
def test_positional_default(self):
215+
class PositionalDefault(Tap):
216+
arg: str
217+
218+
def configure(self):
219+
self.add_argument('arg')
220+
221+
help_regex = r'.*positional arguments:\n.*arg\s*\(str, required\).*'
222+
help_text = PositionalDefault().format_help()
223+
self.assertRegexpMatches(help_text, help_regex)
224+
214225

215226
if __name__ == '__main__':
216227
unittest.main()

0 commit comments

Comments
 (0)