(self)
| 3303 | self.assertRaises(TypeError, ErrorRaisingArgumentParser, parents=[1]) |
| 3304 | |
| 3305 | def test_mutex_groups_parents(self): |
| 3306 | parent = ErrorRaisingArgumentParser(add_help=False) |
| 3307 | g = parent.add_argument_group(title='g', description='gd') |
| 3308 | g.add_argument('-w') |
| 3309 | g.add_argument('-x') |
| 3310 | m = g.add_mutually_exclusive_group() |
| 3311 | m.add_argument('-y') |
| 3312 | m.add_argument('-z') |
| 3313 | parser = ErrorRaisingArgumentParser(prog='PROG', parents=[parent]) |
| 3314 | |
| 3315 | self.assertRaises(ArgumentParserError, parser.parse_args, |
| 3316 | ['-y', 'Y', '-z', 'Z']) |
| 3317 | |
| 3318 | parser_help = parser.format_help() |
| 3319 | self.assertEqual(parser_help, textwrap.dedent('''\ |
| 3320 | usage: PROG [-h] [-w W] [-x X] [-y Y | -z Z] |
| 3321 | |
| 3322 | options: |
| 3323 | -h, --help show this help message and exit |
| 3324 | |
| 3325 | g: |
| 3326 | gd |
| 3327 | |
| 3328 | -w W |
| 3329 | -x X |
| 3330 | -y Y |
| 3331 | -z Z |
| 3332 | ''')) |
| 3333 | |
| 3334 | # ============================== |
| 3335 | # Mutually exclusive group tests |
nothing calls this directly
no test coverage detected