Move tests for Python inside function.