zenlotus / argparse

Automatically exported from code.google.com/p/argparse
Other
0 stars 0 forks source link

.add_mutually_exclusive_group() only works when child of parser but not when a child of argument group #90

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

parser = argparse.ArgumentParser()
group = parser.add_argument_group("Mutually exclusive group")
megroup = group.add_mutually_exclusive_group()

# megroup.add_argument() won't create mutually exlusive option.

megroup2 = parser.add_mutually_exclusive_group()

# Works as expected

What is the expected output? What do you see instead?

You should be able to create a mutually exclusive group as a child of an 
argument group.

What version of the product are you using? On what operating system?
argpase 1.2.1

Please provide any additional information below.

Tested on Python 2.7 where this works correctly.  The exact same code on Python 
2.6 with argparse 1.2.1 won't enforce mutual exclusion.

Original issue reported on code.google.com by dwa...@translate.org.za on 10 Mar 2014 at 9:07

Attachments: