A further complication on this. With the arguments I defined in the previous post
p.parse_args('--foo test --baz 257'.split())
gives the mutually exclusive error message. `sys.argv` does the same.
p.parse_args(['--foo', 'test', '--baz', '257'])
does not give an error, because here the 'test' argument string is the same as the default 'test'. So the m_x_g test thinks `--foo' is the default, and does not count as an input.
Usually in testing an argparse setup I use the list and split arguments interchangeably, but this shows they are not equivalent. |