lab05 : Accumulator Pattern, more TDD practice
num | ready? | description | assigned | due |
---|---|---|---|---|
lab05 | true | Accumulator Pattern, more TDD practice | Mon 04/30 08:00AM | Mon 05/07 09:00PM |
You may pair or work alone on this lab.
If you choose to pair, please start by logging into Gradescope, finding the link for lab05 and then adding your pair partner.
Instructions
For this lab, you will create two files:
- lab05.py, a file containing some function definitions
- lab05_tests.py, a file containing some test cases
There is starter code for each of these (.py files) at the following link:
I suggest you proceed as follows:
- Create a directory called ~/cs8/lab05 (using the
mkdir
command) andcd
into that directory. - Use
idle3
(you might tryidle3 &
if you want to keep your prompt handy) to bring up idle3. - Use “New File” to create empty files called lab05.py and lab05_tests.py in that ~/cs8/lab05 directory.
- ONE AT A TIME, copy the function definitions from the starter code, and the tests that go along with those, and get the tests to pass.
- By one a a time, what I mean is, at your first step, copy ONLY the first function definition from the starter code lab05.py and copy only the test cases from lab05_tests.py that go with that function definition.
- By one a a time, what I mean is, at your first step, copy ONLY the first function definition from the starter code lab05.py and copy only the test cases from that go with that function definition.
- Then, before you move on to the next function definition and its tests, get all of the tests from the one you just copied to pass.
- Then, and only then, copy the next function definition and its tests into your files.
- Repeat this until you have ALL of the function definitions and their tests, and all of them pass.
Note that what you are given differs from function to function: either a complete function definitions
- In some cases you are given a function definition that is complete, but contains a bug. In this case, you need to fix the function definition.
- In some cases you are given a function definition that is correct. In this case, the code is there for you as an example—it is code that may be helpful to you in writing the other function definitions in the lab. There is nothing you need to do other than study the code to learn how it works.
- In some cases, you are given a stub.
When you’ve done that, you are ready to try submitting to Gradescope for a final grade. HOWEVER, you are encouraged to try submitting to Gradescope earlier, for several reasons:
- You can get partial credit if some of your tests pass for some of your functions
- You will have a backup of your file in case you accidentally delete yours from CSIL, or in case your laptop dies
- You can move code between your laptop and CSIL by downloading your code from the Gradescope submission
- You can ask the instructor or TA questions about your code on Piazza in a private instructor post.
The coding exercises work with the accumulator pattern that we’ve been going over in lecture and the homeworks.
Submission
Navigate to the page for submitting lab05 on Gradescope.com
Navigate to that page, and upload your lab05.py file. It is not necessary to upload the lab05_tests.py file.