Since I won't be here with you on Thursday, we are going to plan our work this week to make best use of that situation. We will use Tuesday's class for an introduction to Python's unittest module, and do an exercise together using it with Test-driven development (TDD).
Thursday, February 13th
Classwork / Homework
Dear CSC 200 students,
I had a chance to at least briefly vet the two resources to which I linked last class, and it turns out that python-tdd-exercises is much closer to our purpose. So here is what I want you to do in my absence today:
- Create a subdirectory in the new
tddexperimentsgit repo you made with your partner last class named
- Inside the
feb13directory copy the two files I've added to my
- Run the test with:
$ python3 -m unittest test_python_tdd_exercises.pyand confirm that you get the following failure:
AssertionError: None != [5, 4, 3, 2, 1]
- Write a function body for
reverse_listthat makes the test pass. Hint: the following will work:
reversed =  for item in lst: reversed = [item] + reversed return reversed
- Repeat this process, adding a test from
TDDExerciseSuite, and then adding a function to the
python_tdd_exercises.pymodule to make the test pass, as class time and homework time allows.
Warning! Please remember to add a link to your
tddexercises repo from a
README.md file in your
csc200 repo which should be linked
quick check revealed most of you have not done this. Leila has, so you can
see her repo for a working
example. Without that link I will have nothing to evaluate and you will
receive a failing grade for the assignment!
To receive an A for this assignment, you need to have a series of commits in your git repo both during class and between the end of class and the beginning of class next Tuesday showing you used the TDD process.
Tuesday, February 11th
We will begin by choosing new pairs for the activities for the next few weeks,
then we will do an activity together introducing Python's
module by writting code to score a
We will do this together in class, and among the tasks will be:
- Either you or you partner will create a new repository on gitlab named
- Whoever created the repo will change the settings to make it public, and to add their partner as a maintainer, who will then clone the repo onto their own local machine.
- Add a link to your new repo from the
README.mdfile of your
You will be evaluated on your git repo, which should show a clear TDD progression, with tests added first to the test file and then code being added to the python module to make the tests pass.