Modified tests for self.assertRaises so it doesn't catch some other error. Fixed some PEP8 warnings