On 3/7/07, Patrick Maupin <[EMAIL PROTECTED]> wrote: > > > Because unittest always creates **kwargs, any code path in a C > > > function which is only executed when the *keywords parameter is NULL > > > will never be correctly tested from the standard unittest methods. > > > > This needs some context; which call from unittest to a C function are > > you talking about? > > Umm, my broken ones? :) In doing some personal doctesting, I noticed > an issue in my PEP3101 code with a null pointer, and added a test to > the unittest code to catch it in preparation for fixing it. My > unittest code never failed, and I realized that the unittest module > was always passing down a keyword dictionary, even when no keywords > were passed to it. I'm sure that most Python C programmers are more > experienced/careful than I am, but even so, it seems that there are a > whole class of potential bugs in C functions that unittest cannot > check for at present, because it always passes a keywords dictionary.
The only place in unittest that uses **kwargs is TestCase.failUnlessRaises()/assertRaises(); is this the method you're using when writing your tests? If so, then don't use assertRaises(): just call your function and trap the exception manually. Collin Winter _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com