Specify encoding for test to pass on Windows

Also minor style changes (PEP8 white spaces).