On 12/9/2009 10:43 AM, Kent Johnson wrote:
So my questions -- Am I misunderstanding how to properly write unit
tests for this case? Or perhaps I've structured my program
incorrectly, and that's what this duplication reveals? I suspected,
for instance, that perhaps I should group these methods
(convertEmDashes, splitLines, etc.) into a single larger function or
method.

Yes, your tests are revealing a problem with the structure. You should
probably have a single process() method that does all the cleanup
methods and the split. Then you could also have a test for this.

I should add, a unittest can be a white-box testing. You can have TestCases for the whole "process" (blackbox test), but you can also have TestCases for each splitLine, convertEmDashes, etc (whitebox test).

The test for the large "process" will be, sort of, a simple integration test for each sub-processes.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to