Restructure test and fix pep8 errors.