def testReindenter(self): with open('test_before.py') as before, open('test_after.py') as after: indenter = Reindenter(before, '\t') expected = after.readlines() self.assertTrue(indenter()) self.assertEqual(indenter.after, expected)
def check_python_file(filename, errors): """Check each modified Python file to make sure it adheres to the standards""" fh = file(filename, "r") r = Reindenter(fh) if r.run(): errors.append('Python file ' + filename + ' has odd indentation; ' \ + 'please run through reindent.py first.')