def execute(self): with open(self._input_file, 'rb') as png_file: with open(self._output_file, 'wb') as data_file: pixels = read_pixels_from_png(png_file) write_data_to_file(convert_pixels_to_bytes(pixels), data_file)
def test_write_data_produces_expected_output(): data = bytearray.fromhex('ffffe3990012') file = io.BytesIO() write_data_to_file(data, file) assert file.getvalue() == data