Updated tests. Fixed flake8 errors