1. Learn
  2. /
  3. Courses
  4. /
  5. Unit Testing for Data Science in Python

Exercise

Your first unit test using pytest

The data file containing housing area and prices uses commas as thousands separators, e.g. "2,081" or "314,942", as you can see in the IPython Shell.

The convert_to_int() function takes a comma separated integer string as argument, and returns the integer. Therefore, the expected return value of convert_to_int("2,081") is the integer 2081.

This function is defined in the module preprocessing_helpers.py. But it is not known if the function is working properly.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Import the pytest package.