def test_file_write_no_append(self): """Overwriting a file.""" autotodo.write(self.todofile, self.todoitems, append=False) self.assertEqual(self.todofile.getvalue(), '\n'.join(map(str, self.todoitems)) + '\n')
def test_file_write_no_append_truncate(self): """Overwriting a file with somethin shorter.""" autotodo.write(self.todofile, self.todoitems[0:1], append=False) self.assertEqual(self.todofile.getvalue(), str(self.todoitems[0]) + '\n')
def test_file_write_appending(self): """Check that something was written.""" autotodo.write(self.todofile, self.todoitems, append=True) self.assertGreater(len(self.todofile.getvalue()), 100)