Remove duplicated Python test code.