Fix PEP8 compatibility
Add test case for error handling