[issue10424] better error message from argparse when positionals missing

2011-06-09 Thread R. David Murray
R. David Murray 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: -> accepted stage: needs patch

[issue10424] better error message from argparse when positionals missing

2011-06-09 Thread Roundup Robot
Roundup Robot 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 ___ Python t

[issue10424] better error message from argparse when positionals missing

2011-05-27 Thread Michele Orrù
Changes by Michele Orrù : Added file: http://bugs.python.org/file22155/issue10424.patch ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue10424] better error message from argparse when positionals missing

2011-05-27 Thread R. David Murray
R. David Murray 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 assertRaisesRegex(ArgumentParseError) as cm:

[issue10424] better error message from argparse when positionals missing

2011-05-27 Thread Éric Araujo
Éric Araujo 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-26 Thread Michele Orrù
Michele Orrù added the comment: Done. -- Added file: http://bugs.python.org/file22129/issue10424_2.patch ___ Python tracker ___ ___ P

[issue10424] better error message from argparse when positionals missing

2011-05-26 Thread R. David Murray
R. David Murray 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 like to see a test wh

[issue10424] better error message from argparse when positionals missing

2010-11-21 Thread Michele Orrù
Changes by Michele Orrù : Removed file: http://bugs.python.org/file19729/issue10424.patch ___ Python tracker ___ ___ Python-bugs-list mailing

[issue10424] better error message from argparse when positionals missing

2010-11-21 Thread Michele Orrù
Michele Orrù 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

[issue10424] better error message from argparse when positionals missing

2010-11-21 Thread Michele Orrù
Changes by Michele Orrù : Removed file: http://bugs.python.org/file19646/issue10424.patch ___ Python tracker ___ ___ Python-bugs-list mailing

[issue10424] better error message from argparse when positionals missing

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

[issue10424] better error message from argparse when positionals missing

2010-11-20 Thread Steven Bethard
Steven Bethard 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 starting with "mark positional

[issue10424] better error message from argparse when positionals missing

2010-11-20 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +eric.araujo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread R. David Murray
R. David Murray 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 really no existing test

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread Michele Orrù
Changes by Michele Orrù : Added file: http://bugs.python.org/file19647/bug10424.py ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread Michele Orrù
Michele Orrù 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, file bug10424.py repr

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread Steven Bethard
Steven Bethard 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 execute if the self.error

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread Michele Orrù
Michele Orrù 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 arguments')) 1926 1927

[issue10424] better error message from argparse when positionals missing

2010-11-15 Thread Steven Bethard
New submission from Steven Bethard : >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') >>> parser.add_argument('spam', nargs