MCPcopy Index your code
hub / github.com/python/cpython / TestOptionalsAlternatePrefixChars

Class TestOptionalsAlternatePrefixChars

Lib/test/test_argparse.py:520–537  ·  view source on GitHub ↗

Test an Optional with option strings with custom prefixes

Source from the content-addressed store, hash-verified

518
519
520class TestOptionalsAlternatePrefixChars(ParserTestCase):
521 """Test an Optional with option strings with custom prefixes"""
522
523 parser_signature = Sig(prefix_chars='+:/', add_help=False)
524 argument_signatures = [
525 Sig('+f', action='store_true'),
526 Sig('::bar'),
527 Sig('/baz', action='store_const', const=42),
528 ]
529 failures = ['--bar', '-fbar', '-b B', 'B', '-f', '--bar B', '-baz', '-h', '--help', '+h', '::help', '/help']
530 successes = [
531 ('', NS(f=False, bar=None, baz=None)),
532 ('+f', NS(f=True, bar=None, baz=None)),
533 ('::ba B', NS(f=False, bar='B', baz=None)),
534 ('+f ::bar B', NS(f=True, bar='B', baz=None)),
535 ('+f /b', NS(f=True, bar=None, baz=42)),
536 ('/ba +f', NS(f=True, bar=None, baz=42)),
537 ]
538
539
540class TestOptionalsAlternatePrefixCharsAddedHelp(ParserTestCase):

Callers

nothing calls this directly

Calls 2

SigClass · 0.85
NSClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…