refactored example.py to a unit test