Fix flake8 errors

Except they're not really errors, which is kind of the whole point here...
Fix tests in Python 2

The "'return' outside of function" SyntaxError apparently doesn't give column
information in Python 2.