def test_round_trip(self): pytools.create_template("utf8_test.py", "junk.template") pytools.py2json("utf8_test.py", "junk.json") pytools.json2py("junk.json", "junk.template", "junk.py") self.assertTrue(filecmp.cmp("utf8_test.py", "junk.py", shallow=False)) for f in ["junk.template", "junk.json", "junk.py"]: os.remove(f)
def test_create_file(self): pytools.create_template("utf8_test.py", "junk") self.assertTrue(filecmp.cmp("utf8_test.template", "junk", shallow=False)) # NOQA os.remove("junk")
def test_create_str(self): with open("utf8_test.template") as filename: content = filename.read() self.assertEqual(pytools.create_template("utf8_test.py"), content)