(self)
| 3271 | ''')) |
| 3272 | |
| 3273 | def test_groups_parents(self): |
| 3274 | parent = ErrorRaisingArgumentParser(add_help=False) |
| 3275 | g = parent.add_argument_group(title='g', description='gd') |
| 3276 | g.add_argument('-w') |
| 3277 | g.add_argument('-x') |
| 3278 | m = parent.add_mutually_exclusive_group() |
| 3279 | m.add_argument('-y') |
| 3280 | m.add_argument('-z') |
| 3281 | parser = ErrorRaisingArgumentParser(prog='PROG', parents=[parent]) |
| 3282 | |
| 3283 | self.assertRaises(ArgumentParserError, parser.parse_args, |
| 3284 | ['-y', 'Y', '-z', 'Z']) |
| 3285 | |
| 3286 | parser_help = parser.format_help() |
| 3287 | self.assertEqual(parser_help, textwrap.dedent('''\ |
| 3288 | usage: PROG [-h] [-w W] [-x X] [-y Y | -z Z] |
| 3289 | |
| 3290 | options: |
| 3291 | -h, --help show this help message and exit |
| 3292 | -y Y |
| 3293 | -z Z |
| 3294 | |
| 3295 | g: |
| 3296 | gd |
| 3297 | |
| 3298 | -w W |
| 3299 | -x X |
| 3300 | ''')) |
| 3301 | |
| 3302 | def test_wrong_type_parents(self): |
| 3303 | self.assertRaises(TypeError, ErrorRaisingArgumentParser, parents=[1]) |
nothing calls this directly
no test coverage detected