Cleaned tests file to correct all pyflakes and pep8 errors

I agree that it probably does nothing. I didn't want to mix changing tests with formatting changes to keep the review and refactoring easier.