class_docstr: Test zipapp module functionality.
class_docstr_tok: ["Test","zipapp","module","functionality","."]
code: def test_create_archive_with_subdirs(self):
      # Test packing a directory includes entries for subdirectories.
      source = self.tmpdir / "source"
      source.mkdir()
      (source / "__main__.py").touch()
      (source / "foo").mkdir()
      (source / "bar").mkdir()
      (source / "foo" / "__init__.py").touch()
      target = io.BytesIO()
      zipapp.create_archive(str(source), target)
      target.seek(0)
      with zipfile.ZipFile(target, "r") as z:
          self.assertIn("foo/", z.namelist())
          self.assertIn("bar/", z.namelist())
  
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 4 for calling the ZipAppTest obj's underlying member method code with example usage: obj.test_create_archive_with_subdirs() without return types