Fixing failed unittest and making PEP compliant