(self)
| 7165 | self.theme = _colorize.get_theme(force_color=True).argparse |
| 7166 | |
| 7167 | def test_argparse_color(self): |
| 7168 | # Arrange: create a parser with a bit of everything |
| 7169 | parser = argparse.ArgumentParser( |
| 7170 | color=True, |
| 7171 | description="Colorful help", |
| 7172 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 7173 | prefix_chars="-+", |
| 7174 | prog="PROG", |
| 7175 | ) |
| 7176 | group = parser.add_mutually_exclusive_group() |
| 7177 | group.add_argument( |
| 7178 | "-v", "--verbose", action="store_true", help="more spam" |
| 7179 | ) |
| 7180 | group.add_argument( |
| 7181 | "-q", "--quiet", action="store_true", help="less spam" |
| 7182 | ) |
| 7183 | parser.add_argument("x", type=int, help="the base") |
| 7184 | parser.add_argument( |
| 7185 | "y", type=int, help="the exponent", deprecated=True |
| 7186 | ) |
| 7187 | parser.add_argument( |
| 7188 | "this_indeed_is_a_very_long_action_name", |
| 7189 | type=int, |
| 7190 | help="the exponent", |
| 7191 | ) |
| 7192 | parser.add_argument( |
| 7193 | "-o", "--optional1", action="store_true", deprecated=True |
| 7194 | ) |
| 7195 | parser.add_argument("--optional2", help="pick one") |
| 7196 | parser.add_argument("--optional3", choices=("X", "Y", "Z")) |
| 7197 | parser.add_argument( |
| 7198 | "--optional4", choices=("X", "Y", "Z"), help="pick one" |
| 7199 | ) |
| 7200 | parser.add_argument( |
| 7201 | "--optional5", choices=("X", "Y", "Z"), help="pick one" |
| 7202 | ) |
| 7203 | parser.add_argument( |
| 7204 | "--optional6", choices=("X", "Y", "Z"), help="pick one" |
| 7205 | ) |
| 7206 | parser.add_argument( |
| 7207 | "-p", |
| 7208 | "--optional7", |
| 7209 | choices=("Aaaaa", "Bbbbb", "Ccccc", "Ddddd"), |
| 7210 | help="pick one", |
| 7211 | ) |
| 7212 | |
| 7213 | parser.add_argument("+f") |
| 7214 | parser.add_argument("++bar") |
| 7215 | parser.add_argument("-+baz") |
| 7216 | parser.add_argument("-c", "--count") |
| 7217 | |
| 7218 | subparsers = parser.add_subparsers( |
| 7219 | title="subcommands", |
| 7220 | description="valid subcommands", |
| 7221 | help="additional help", |
| 7222 | ) |
| 7223 | subparsers.add_parser("sub1", deprecated=True, help="sub1 help") |
| 7224 | sub2 = subparsers.add_parser("sub2", deprecated=True, help="sub2 help") |
nothing calls this directly
no test coverage detected