111filename=os.path.join(112os.path.join('hopefullynonexistingpathname'),113'invalid_file.xml')114try:115self.tree.write(filename)116exceptIOError:117pass118else:119self.assertTrue(120False,"writing to an invalid file path should fail")