code: def test_newhadoop(self):
      basepath = self.tempdir.name
      data = [(1, ""), (1, "a"), (2, "bcdf")]
      self.sc.parallelize(data).saveAsNewAPIHadoopFile(
          basepath + "/newhadoop/",
          "org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat",
          "org.apache.hadoop.io.IntWritable",
          "org.apache.hadoop.io.Text",
      )
      result = sorted(
          self.sc.newAPIHadoopFile(
              basepath + "/newhadoop/",
              "org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat",
              "org.apache.hadoop.io.IntWritable",
              "org.apache.hadoop.io.Text",
          ).collect()
      )
      self.assertEqual(result, data)
  
      conf = {
          "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.Text",
          "mapreduce.output.fileoutputformat.outputdir": basepath
          + "/newdataset/",
      }
      self.sc.parallelize(data).saveAsNewAPIHadoopDataset(conf)
      input_conf = {
          "mapreduce.input.fileinputformat.inputdir": basepath
          + "/newdataset/"
      }
      new_dataset = sorted(
          self.sc.newAPIHadoopRDD(
              "org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat",
              "org.apache.hadoop.io.IntWritable",
              "org.apache.hadoop.io.Text",
              conf=input_conf,
          ).collect()
      )
      self.assertEqual(new_dataset, data)
  
imports: import os
  import shutil
  import tempfile
  import unittest
  from pyspark.testing.utils import ReusedPySparkTestCase, SPARK_HOME
label_desc: Use image node_id 4 for calling the OutputFormatTests obj's underlying member method code with example usage: obj.test_newhadoop() without return types