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

Method test_argparse_color

Lib/test/test_argparse.py:7299–7429  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7297 self.theme = _colorize.get_theme(force_color=True).argparse
7298
7299 def test_argparse_color(self):
7300 # Arrange: create a parser with a bit of everything
7301 parser = argparse.ArgumentParser(
7302 color=True,
7303 description="Colorful help",
7304 formatter_class=argparse.ArgumentDefaultsHelpFormatter,
7305 prefix_chars="-+",
7306 prog="PROG",
7307 )
7308 group = parser.add_mutually_exclusive_group()
7309 group.add_argument(
7310 "-v", "--verbose", action="store_true", help="more spam"
7311 )
7312 group.add_argument(
7313 "-q", "--quiet", action="store_true", help="less spam"
7314 )
7315 parser.add_argument("x", type=int, help="the base")
7316 parser.add_argument(
7317 "y", type=int, help="the exponent", deprecated=True
7318 )
7319 parser.add_argument(
7320 "this_indeed_is_a_very_long_action_name",
7321 type=int,
7322 help="the exponent",
7323 )
7324 parser.add_argument(
7325 "-o", "--optional1", action="store_true", deprecated=True
7326 )
7327 parser.add_argument("--optional2", help="pick one")
7328 parser.add_argument("--optional3", choices=("X", "Y", "Z"))
7329 parser.add_argument(
7330 "--optional4", choices=("X", "Y", "Z"), help="pick one"
7331 )
7332 parser.add_argument(
7333 "--optional5", choices=("X", "Y", "Z"), help="pick one"
7334 )
7335 parser.add_argument(
7336 "--optional6", choices=("X", "Y", "Z"), help="pick one"
7337 )
7338 parser.add_argument(
7339 "-p",
7340 "--optional7",
7341 choices=("Aaaaa", "Bbbbb", "Ccccc", "Ddddd"),
7342 help="pick one",
7343 )
7344 parser.add_argument(
7345 "--optional8",
7346 default="A",
7347 metavar="X",
7348 choices=("A", "B", "C"),
7349 help="among %(choices)s, default is %(default)s",
7350 )
7351
7352 parser.add_argument("+f")
7353 parser.add_argument("++bar")
7354 parser.add_argument("-+baz")
7355 parser.add_argument("-c", "--count")
7356

Callers

nothing calls this directly

Calls 7

add_subparsersMethod · 0.95
format_helpMethod · 0.95
add_parserMethod · 0.80
add_argumentMethod · 0.45
assertEqualMethod · 0.45
dedentMethod · 0.45

Tested by

no test coverage detected