(self)
| 3160 | ''')) |
| 3161 | |
| 3162 | def test_groups_parents(self): |
| 3163 | parent = ErrorRaisingArgumentParser(add_help=False) |
| 3164 | g = parent.add_argument_group(title='g', description='gd') |
| 3165 | g.add_argument('-w') |
| 3166 | g.add_argument('-x') |
| 3167 | m = parent.add_mutually_exclusive_group() |
| 3168 | m.add_argument('-y') |
| 3169 | m.add_argument('-z') |
| 3170 | parser = ErrorRaisingArgumentParser(prog='PROG', parents=[parent]) |
| 3171 | |
| 3172 | self.assertRaises(ArgumentParserError, parser.parse_args, |
| 3173 | ['-y', 'Y', '-z', 'Z']) |
| 3174 | |
| 3175 | parser_help = parser.format_help() |
| 3176 | self.assertEqual(parser_help, textwrap.dedent('''\ |
| 3177 | usage: PROG [-h] [-w W] [-x X] [-y Y | -z Z] |
| 3178 | |
| 3179 | options: |
| 3180 | -h, --help show this help message and exit |
| 3181 | -y Y |
| 3182 | -z Z |
| 3183 | |
| 3184 | g: |
| 3185 | gd |
| 3186 | |
| 3187 | -w W |
| 3188 | -x X |
| 3189 | ''')) |
| 3190 | |
| 3191 | def test_wrong_type_parents(self): |
| 3192 | self.assertRaises(TypeError, ErrorRaisingArgumentParser, parents=[1]) |
nothing calls this directly
no test coverage detected