class_docstr: Test zipapp module functionality.
class_docstr_tok: ["Test","zipapp","module","functionality","."]
code: def test_write_shebang_to_fileobj(self):
      # Test that we can change the shebang of a file, writing the result to a
      # file object.
      source = self.tmpdir / "source"
      source.mkdir()
      (source / "__main__.py").touch()
      target = self.tmpdir / "source.pyz"
      zipapp.create_archive(
          str(source), str(target), interpreter="python"
      )
      new_target = io.BytesIO()
      zipapp.create_archive(
          str(target), new_target, interpreter="python2.7"
      )
      self.assertTrue(
          new_target.getvalue().startswith(b"#!python2.7\n")
      )
  
imports: import io
  import pathlib
  import stat
  import sys
  import tempfile
  import unittest
  import zipapp
  import zipfile
  from test.support import requires_zlib
  from test.support import os_helper
  from unittest.mock import patch
label_desc: Use image node_id 21 for calling the ZipAppTest obj's underlying member method code with example usage: obj.test_write_shebang_to_fileobj() without return types