Skip to content

Assignment A12

Choose a tag to compare

@deemasaddik deemasaddik released this 07 Dec 04:28
ef9e125

Using the Crime dataset we will work on writing unit testing and packaging the unit tests into a module that can be published. (See Lec19)

Instruction:
Part 1: Write modules and unit test
Create two separate modules in python
validate_functions.py - Write a script that checks that the 'Vict sex' column is either M or F and not missing (NULL). Additonally, check the column 'Vict age' that the values are between 1-100 and not missing (NULL)
stats_function.py - Write a script that iterates the age column and calculates the mean and median age.
Write a unit test that takes in your python scripts as libraries and perform unit tests on them. For the modules:
For the stats_function module, test if your script returns a valid value. Consider an edge case and write a unit test for it.
For the validate_functions module, test if the value is the wrong datatype
Freeze your environment to build a requirement.txt
Package all the script into a directory called 'crime_test'.

Part 2: Build your package
In addition to your directory, include the additional files needed to build a package; init.py and setup.py
For setup.py include your package information (name and version) and dependencies.
For init.py, include the metadata of your version of this library
Build your package
Part 3: Publish your package on GitHub
Once your package is built, send your library to another classmate and have them test it out to see if they can download, install and run it.
Install your classmate package and report issues to your classmate
Write a summary, as text input in your submission, on your classmates feedback and what feedback you had for your classmate