class_docstr: TFRecordWriter Zlib test
class_docstr_tok: ["TFRecordWriter","Zlib","test"]
docstr: test ZLib Flush Record
docstr_tok: ["test","ZLib","Flush","Record"]
code: def testZLibFlushRecord(self):
      """test ZLib Flush Record"""
      original = [b"small record"]
      fn = self._WriteRecordsToFile(original, "small_record")
      with open(fn, "rb") as h:
          buff = h.read()
  
      # creating more blocks and trailing blocks shouldn't break reads
      compressor = zlib.compressobj(9, zlib.DEFLATED, zlib.MAX_WBITS)
  
      output = b""
      for c in buff:
          if isinstance(c, int):
              c = six.int2byte(c)
          output += compressor.compress(c)
          output += compressor.flush(zlib.Z_FULL_FLUSH)
  
      output += compressor.flush(zlib.Z_FULL_FLUSH)
      output += compressor.flush(zlib.Z_FULL_FLUSH)
      output += compressor.flush(zlib.Z_FINISH)
  
      # overwrite the original file with the compressed data
      with open(fn, "wb") as h:
          h.write(output)
  
      options = tf_record.TFRecordOptions(TFRecordCompressionType.ZLIB)
      actual = list(tf_record.tf_record_iterator(fn, options=options))
      self.assertEqual(actual, original)
  
imports: import gzip
  import os
  import random
  import string
  import zlib
  import six
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.lib.io import tf_record
  from tensorflow.python.platform import test
  from tensorflow.python.util import compat
label_desc: Use image node_id 1 for calling the TFRecordWriterZlibTest obj's underlying member method code with example usage: obj.testZLibFlushRecord() without return types