code: def testWriteFile(self):
      cases = ["", "Some contents"]
      for contents in cases:
          contents = compat.as_bytes(contents)
          with tempfile.NamedTemporaryFile(
              prefix="WriteFileTest",
              dir=self.get_temp_dir(),
              delete=False,
          ) as temp:
              pass
          with self.cached_session() as sess:
              w = io_ops.write_file(temp.name, contents)
              self.evaluate(w)
              with open(temp.name, "rb") as f:
                  file_contents = f.read()
              self.assertEqual(file_contents, contents)
          os.remove(temp.name)
  
file_path: tensorflow/tensorflow/python/kernel_tests/io_ops/io_ops_test.py
imports: import os
  import shutil
  import tempfile
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import io_ops
  from tensorflow.python.platform import test
  from tensorflow.python.util import compat
label_desc: Use image node_id 2 for calling the IoOpsTest obj's underlying member method code with example usage: obj.testWriteFile() without return types