Lab 11: Unit testing Solution

$30.00 $24.00

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…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

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

  1. Write one or more unit tests to test the count() method

  1. Write one or more unit tests to test the count_alpha() method

  1. Write one or more unit tests to test the count_numeric() method

  1. Write one or more unit tests to test the count_vowels() method

  1. Write one or more unit tests to test the is_phonenumber() method

  1. 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.

Lab 11: Unit testing Solution
$30.00 $24.00