Serdar Tumgoren wrote:
Hi everyone, The list recently discussed the virtues of unit testing, and I was hoping someone could offer some high-level advice and further resources as I try to apply the TDD methodology.
TDD is different from data validation. TDD ensures program correctness. Data validation ensures input correctness.
In such a case, should I be writing test cases for *expected* inputs and then coding the the parser portion of my program to handle the myriad of possible "bad" data?
Yes, the parser should handle all bad data and respond in appropriate manner (raise an error or flag for manual check by programmer). Input should be sanitized as early as possible.
If you want to apply TDD here; you will be checking that the parser correctly normalize all "bad" data into the proper form (e.g. all 0, None, False, <empty></empty> in the boolean field is properly normalized to False (I assume there is no difference between each different representation of False?)).
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor