def test_temp_gzip_is_removed(self): """Test that the gzip file is removed.""" with common_utils.NamedTemporaryGZip() as temp_gzip: file_name = temp_gzip.name self.assertTrue(exists(file_name)) self.assertFalse(exists(file_name))
def test_gzip_is_readable(self): """Test the the written gzip file is readable.""" test_data = "Test Read Gzip" with common_utils.NamedTemporaryGZip() as temp_gzip: temp_gzip.write(test_data) temp_gzip.close() with gzip.open(temp_gzip.name, "rt") as f: read_data = f.read() self.assertEqual(test_data, read_data)