refine the unit tests of the Python code using unittest