refactored python tests