Exemple #1
0
 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)
Exemple #2
0
 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')
Exemple #3
0
 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')
Exemple #4
0
 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'))