Cleaned tests file to correct all pyflakes and pep8 errors

This would be nicer if the curly braces each had their own lines, as did each of the key-value pairs.