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

Method test_help_description_groups

Lib/test/test_optparse.py:1562–1597  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1560 self.assertHelpEquals(expect)
1561
1562 def test_help_description_groups(self):
1563 self.parser.set_description(
1564 "This is the program description for %prog. %prog has "
1565 "an option group as well as single options.")
1566
1567 group = OptionGroup(
1568 self.parser, "Dangerous Options",
1569 "Caution: use of these options is at your own risk. "
1570 "It is believed that some of them bite.")
1571 group.add_option("-g", action="store_true", help="Group option.")
1572 self.parser.add_option_group(group)
1573
1574 expect = """\
1575Usage: bar.py [options]
1576
1577This is the program description for bar.py. bar.py has an option group as
1578well as single options.
1579
1580Options:
1581 -a APPLE throw APPLEs at basket
1582 -b NUM, --boo=NUM shout "boo!" NUM times (in order to frighten away all the
1583 evil spirits that cause trouble and mayhem)
1584 --foo=FOO store FOO in the foo list for later fooing
1585 -h, --help show this help message and exit
1586
1587 Dangerous Options:
1588 Caution: use of these options is at your own risk. It is believed
1589 that some of them bite.
1590
1591 -g Group option.
1592"""
1593
1594 self.assertHelpEquals(expect)
1595
1596 self.parser.epilog = "Please report bugs to /dev/null."
1597 self.assertHelpEquals(expect + "\nPlease report bugs to /dev/null.\n")
1598
1599
1600class TestMatchAbbrev(BaseTest):

Callers

nothing calls this directly

Calls 5

assertHelpEqualsMethod · 0.95
OptionGroupClass · 0.90
set_descriptionMethod · 0.80
add_option_groupMethod · 0.80
add_optionMethod · 0.45

Tested by

no test coverage detected