def test_non_existent_parent_write(self): self.path = self.prefix + "/" + self.prefix content = "some content" try: write(".", self.path, content) except IOError: self.path = None raise AssertionError("Path doesn't exist")
def test_existent_parent_write(self): tempdir = None try: tempdir = tempfile.mkdtemp() self.path = tempfile.mktemp(dir=tempdir) content = "some content" write(".", self.path, content) self.assertCorrect(self.path, content) finally: # Teardown if tempdir is not None: shutil.rmtree(tempdir) self.path = None
def test_xml_write(self): self.path = tempfile.mktemp(suffix=".xml") content = "<node>test</node>\n<node>test2</node>\n" write(".", self.path, content) self.assertCorrect(self.path, content)
def test_simple_write(self): self.path = tempfile.mktemp() content = "some content" write(".", self.path, content) self.assertCorrect(self.path, content)