def test_writetxtoverwrite(self): with tempdir() as dirname: bd = DataDir(dirname) bd.write_txt('test1.txt', 'hello') bd.write_txt('test1.txt', 'hello', overwrite=True)
def test_writetxt(self): with tempdir() as dirname: bd = DataDir(dirname) bd.write_txt('test1.txt', 'hello') self.assertEqual(bd.read_txt('test1.txt'), 'hello')
def test_writetxtdonotoverwrite(self): with tempdir() as dirname: bd = DataDir(dirname) bd.write_txt('test1.txt', 'hello') self.assertRaises(OSError, bd._write_txt, 'test1.txt', 'hello')
def test_deletefiles(self): with tempdir() as dirname: bd = DataDir(dirname) bd.write_txt('test1.txt', 'hello') bd.write_txt('test2.txt', 'hello') bd.delete_files(('test1.txt', 'test2.txt', 'test3.txt'))