$29
Exercises
• Review the Python 3 unit test framework documentation: https://docs.python.org/3/library/unittest.html
• Clone a copy of the Lab11-Files repository named CU-CSCI3308-PythonUnitTesting by using the following command.
git clone https://github.com/lizboese/CU-CSCI3308-PythonUnitTesting
This repository includes a simple Python 3 module with a class called Processor that performs some basic analysis methods on the input text. The repository also contains the start of a Python 3 unittest file:textproc_test.py.Execute this file to confirm that the single, initial unit test passes.
• Review the test code in the textproc_test.pyfile.
Questions
Add the following tests to the textproc_test.py file:
1. Write a test to verify the constructor raises an error if passed something other than a string
2. Write one or more unit tests to test the count() method
3. Write one or more unit tests to test the count_alpha() method
4. Write one or more unit tests to test the count_numeric() method
5. Write one or more unit tests to test the count_vowels() method
6. Write one or more unit tests to test the is_phonenumber() method
7. Find and correct any bugs the tests turn up. Document the bugs that you have corrected in comments at the top of your textproc_test.py file, just underneath the comments that include your name(s).
Credit
To get credit for this lab exercise, turn textproc_test.py in on Moodle. Make sure that all partners’ names are included in the file.