예제 #1
0
 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)
예제 #2
0
 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")
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
 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)