def setUp(self): self.temp_path = mkdtemp() self.srcfile = os.path.join(CURRENT_DIR, 'sample', 'dir2', TEST_IMAGE) self.dstfile = os.path.join(self.temp_path, TEST_IMAGE) img = Image(self.srcfile) img.save(self.dstfile) copy_exif(self.srcfile, self.dstfile)
class TestImage(unittest.TestCase): "Test the Image class." def setUp(self): self.temp_path = mkdtemp() self.srcfile = os.path.join(CURRENT_DIR, 'sample', 'dir2', TEST_IMAGE) self.dstfile = os.path.join(self.temp_path, TEST_IMAGE) self.img = Image(self.srcfile) def tearDown(self): rmtree(self.temp_path) def test_imgname(self): self.assertEqual(self.img.imgname, TEST_IMAGE) def test_save(self): self.img.save(self.dstfile) self.assertTrue(os.path.isfile(self.dstfile))