In my opinion, the unittest framework is way too cumbersome for an
introductory course. Doctests are simple and self-explanatory.
Students should get in the habit of writing a doctest for every function
they write, even before the function itself is written.
The main limitation of doctest is that it doesn't preserve values or
maintain a set order when testing a bunch of functions. That can be
fixed, however, by providing your own framework - a test function that
calls the other functions in whatever order you want. The framework
test is then just another doctest in the test function itself. This is
a simple extension of what the students already know.
--
************************************************************ *
* David MacQuigg, PhD email: macquigg at ece.arizona.edu * *
* Research Associate phone: USA 520-721-4583 * * *
* ECE Department, University of Arizona * * *
* 9320 East Mikelyn Lane * * *
* http://purl.net/macquigg Tucson, Arizona 85710 *
************************************************************ *
On 2/23/11 9:05 PM, Zac Miller wrote:
Does anyone teach any unittest or test driven development to high school (or other)
students? I'm looking for a quick reference or "cheat sheet" for python's
unittest that I found around the internet once and never bookmarked. I may be imagining
it but I remember it being great. If anyone knows the one that I think I saw one time or
has a great one they wouldn't mind sharing I'd be very thankful! If not...perhaps it is
my destiny to create one.
-J. Zachary Miller
_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig