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 really no existing test class in test_argparse that would be an 
appropriate place to put a unit test for this.  

I would instead create a new class.  Perhaps TestErrorContent?  For this test 
it would probably be best to use assertRaisesRegexp and just check to make sure 
that the expected list of argument names appears in the message (that is, don't 
test the contents of the remainder of the message).  You should test several 
combinations.  (The argparse tests do some fancy footwork around errors, 
though, so you may not be able to use assertRaisesRegexp directly).

Your approach to the patch, by the way, is an interesting one, and seems to me 
to make sense.  But I'm not 100% sure I understand the logic of the code you 
are modifying, so I'll leave it to Steven to comment on that aspect of it :)

Your reference to TestArgumentError reveals a minor bug in the tests: there are 
actually two test classes named TestArgumentError.  Presumably the second one 
was indeed supposed to be TestArgumentTypeError.  I've fixed that in r86542.

----------
nosy: +r.david.murray

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10424>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to