def test_compress_single_gif(self): compressor = pngcompressor.compress(self.get_tmp_file('large gif')) self.wait(compressor) old_file_size = os.path.getsize(self.get_file('large gif')) new_file_size = os.path.getsize(self.get_tmp_file('large gif')) self.assertTrue(old_file_size > new_file_size)
def test_compress_directory(self): before_sizes = [os.path.getsize(os.path.join(self.tmp_path, path)) for path in os.listdir(self.tmp_path) if os.path.isfile(os.path.join(self.tmp_path, path))] compressor = pngcompressor.compress(self.tmp_path) self.wait(compressor) after_sizes = [os.path.getsize(os.path.join(self.tmp_path, path)) for path in os.listdir(self.tmp_path) if os.path.isfile(os.path.join(self.tmp_path, path))] self.assertNotEqual(before_sizes, after_sizes)
def test_bypass_animated_gif(self): compressor = pngcompressor.compress(self.get_tmp_file('animation')) self.wait(compressor) self.assertFalse(os.path.isfile(self.get_tmp_file('animation')))
def test_bypass_png(self): compressor = pngcompressor.compress(self.get_tmp_file('small png')) self.wait(compressor) self.assertFalse(os.path.isfile(self.get_tmp_file('large png')))