Solve this data transformation problem using Python, and then write three unit tests to verify your solution.