Simplify that last test and fix flake8 errors