def test_save_names_readback(self): fname = make_temp_filename(text=True) self.data.save_names(fname, "w") names = set(self.data.names) rb = read_names(fname) self.assertEqual(names, rb) os.remove(fname)
def test_save_names_write_r_not_exists_fail(self): fname = make_temp_filename(text=True) os.remove(fname) with self.assertRaises(FileNotFoundError): self.data.save_names(fname, "r")
def test_save_names_write_x_fail(self): fname = make_temp_filename(text=True) with self.assertRaises(FileExistsError): self.data.save_names(fname, "x") os.remove(fname)
def test_save_names_write_r_exists_fail(self): fname = make_temp_filename(text=True) with self.assertRaises(io.UnsupportedOperation): self.data.save_names(fname, "r") os.remove(fname)
def test_save_names_write_x(self): with self.assertNotRaises(): fname = make_temp_filename(text=True) os.remove(fname) self.data.save_names(fname, "x") os.remove(fname)