code: def test_reserialization(self):
      basepath = self.tempdir.name
      x = range(1, 5)
      y = range(1001, 1005)
      data = list(zip(x, y))
      rdd = self.sc.parallelize(x).zip(self.sc.parallelize(y))
      rdd.saveAsSequenceFile(basepath + "/reserialize/sequence")
      result1 = sorted(
          self.sc.sequenceFile(
              basepath + "/reserialize/sequence"
          ).collect()
      )
      self.assertEqual(result1, data)
  
      rdd.saveAsHadoopFile(
          basepath + "/reserialize/hadoop",
          "org.apache.hadoop.mapred.SequenceFileOutputFormat",
      )
      result2 = sorted(
          self.sc.sequenceFile(
              basepath + "/reserialize/hadoop"
          ).collect()
      )
      self.assertEqual(result2, data)
  
      rdd.saveAsNewAPIHadoopFile(
          basepath + "/reserialize/newhadoop",
          "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat",
      )
      result3 = sorted(
          self.sc.sequenceFile(
              basepath + "/reserialize/newhadoop"
          ).collect()
      )
      self.assertEqual(result3, data)
  
      conf4 = {
          "mapred.output.format.class": "org.apache.hadoop.mapred.SequenceFileOutputFormat",
          "mapreduce.job.output.key.class": "org.apache.hadoop.io.IntWritable",
          "mapreduce.job.output.value.class": "org.apache.hadoop.io.IntWritable",
          "mapreduce.output.fileoutputformat.outputdir": basepath
          + "/reserialize/dataset",
      }
      rdd.saveAsHadoopDataset(conf4)
      result4 = sorted(
          self.sc.sequenceFile(
              basepath + "/reserialize/dataset"
          ).collect()
      )
      self.assertEqual(result4, data)
  
      conf5 = {
          "mapreduce.job.outputformat.class": (
              "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat"
          ),
          "mapreduce.job.output.key.class": "org.apache.hadoop.io.IntWritable",
          "mapreduce.job.output.value.class": "org.apache.hadoop.io.IntWritable",
          "mapreduce.output.fileoutputformat.outputdir": basepath
          + "/reserialize/newdataset",
      }
      rdd.saveAsNewAPIHadoopDataset(conf5)
      result5 = sorted(
          self.sc.sequenceFile(
              basepath + "/reserialize/newdataset"
          ).collect()
      )
      self.assertEqual(result5, data)
  
imports: import os
  import shutil
  import tempfile
  import unittest
  from pyspark.testing.utils import ReusedPySparkTestCase, SPARK_HOME
label_desc: Use image node_id 8 for calling the OutputFormatTests obj's underlying member method code with example usage: obj.test_reserialization() without return types