[issue10424] better error message from argparse when positionals missing

2011-06-09 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset cab204a79e09 by R David Murray in branch 'default': #10424: argument names are now included in the missing argument message http://hg.python.org/cpython/rev/cab204a79e09 -- nosy: +python-dev

[issue10424] better error message from argparse when positionals missing

2011-06-09 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: With input from Michele on IRC I updated the tests to be more generic (not depend on the order of the reported argument names) and moved the test I talked about in my last message into a third unit test. -- resolution: -

[issue10424] better error message from argparse when positionals missing

2011-05-27 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: FYI, you can upload versions of the same patch with the same name and remove old versions. The code review tool will remember versions, and it’s easier for human if there’s only one patch. -- versions: +Python 3.3 -Python 3.2

[issue10424] better error message from argparse when positionals missing

2011-05-27 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: What I had in mind for the second test was something that did this (which I think is legal from reading the docs): parser.add_argument('foo') parser.add_argument('bar', nargs='?', default='eggs') with

[issue10424] better error message from argparse when positionals missing

2011-05-27 Thread Michele Orrù
Changes by Michele Orrù maker...@gmail.com: Added file: http://bugs.python.org/file22155/issue10424.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10424 ___

[issue10424] better error message from argparse when positionals missing

2011-05-26 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: I would remove the docstring from the new test class...if more tests of message content are added that docstring won't be accurate. It really isn't needed. (Also, shouldn't the test method be named test_missingarguments?) I would also

[issue10424] better error message from argparse when positionals missing

2011-05-26 Thread Michele Orrù
Michele Orrù maker...@gmail.com added the comment: Done. -- Added file: http://bugs.python.org/file22129/issue10424_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10424 ___

[issue10424] better error message from argparse when positionals missing

2010-11-21 Thread Michele Orrù
Michele Orrù maker...@gmail.com added the comment: Unittest added. -- Added file: http://bugs.python.org/file19729/issue10424.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10424 ___

[issue10424] better error message from argparse when positionals missing

2010-11-21 Thread Michele Orrù
Changes by Michele Orrù maker...@gmail.com: Removed file: http://bugs.python.org/file19646/issue10424.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10424 ___

[issue10424] better error message from argparse when positionals missing

2010-11-21 Thread Michele Orrù
Michele Orrù maker...@gmail.com added the comment: Ezio reviewed my patch; here there's the new version with some improvements. -- Added file: http://bugs.python.org/file19736/issue10424.patch ___ Python tracker rep...@bugs.python.org

[issue10424] better error message from argparse when positionals missing

2010-11-21 Thread Michele Orrù
Changes by Michele Orrù maker...@gmail.com: Removed file: http://bugs.python.org/file19729/issue10424.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10424 ___

[issue10424] better error message from argparse when positionals missing

2010-11-20 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10424 ___ ___ Python-bugs-list

[issue10424] better error message from argparse when positionals missing

2010-11-20 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Yeah a new test class is fine. And I checked the patch and it looks okay to me. My first thought was also wait does that really work? but I see that positionals are all marked as required when appropriate (look for the comment

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread Michele Orrù
Michele Orrù maker...@gmail.com added the comment: This issue seems already fixed. File: Lib/argparse.py 922 # if we didn't use all the Positional objects, there were too few 1923 # arg strings supplied. 1924 if positionals: 1925 self.error(_('too few

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: No, it's exactly line 1925 that's the problem. The OP would like that to tell him which arguments were missing instead of saying just 'too few arguments'. The block below that is for checking required optionals/positionals. It won't

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread Michele Orrù
Michele Orrù maker...@gmail.com added the comment: The attached patch solves this issue. I haven't added any unittest because test_argparse.py is quite huge - over 4300 lines-, and I was undecided between «ArgumentError tests» (4251) and «ArgumentTypeError tests» (4262). Any hint? However,

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread Michele Orrù
Changes by Michele Orrù maker...@gmail.com: Added file: http://bugs.python.org/file19647/bug10424.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10424 ___

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: There are currently no tests in argparse that test the content of error messages, which is fairly standard for stdlib tests since the error messages aren't considered part of the API (only the nature of the exception is). So there's

[issue10424] better error message from argparse when positionals missing

2010-11-15 Thread Steven Bethard
New submission from Steven Bethard steven.beth...@gmail.com: From a private email in respect to the following class of error messages: parser = argparse.ArgumentParser(prog='PROG') parser.add_argument('--foo') parser.add_argument('--bar') parser.add_argument('ham')