def test_clean_pep8(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_pep8_clean") name = os.path.join(temp, "python_try.py") with open(name, "w") as f: f.write(""" import sys import os def f1 () : #g return [2,3] """.replace(" ", "")) r = remove_extra_spaces_and_pep8(name) assert r > 0 with open(name, "r") as f: content = f.read() self.assertEqual(content.strip(), """ import sys import os def f1(): # g return [2, 3] """.replace(" ", "").strip()) r = remove_extra_spaces_and_pep8(name) self.assertEqual(r, 0)
def test_pep8(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor(): return this = os.path.abspath(__file__.replace(".pyc", ".py")) try: diff = remove_extra_spaces_and_pep8(this) except IndexError as e: warnings.warn("probably an issue with pep8: " + str(e)) return assert diff < 10