code: def test_add_defaults(self):
      # http://bugs.python.org/issue2279
  
      # add_default should also include
      # data_files and package_data
      dist, cmd = self.get_cmd()
  
      # filling data_files by pointing files
      # in package_data
      dist.package_data = {
          "": ["*.cfg", "*.dat"],
          "somecode": ["*.txt"],
      }
      self.write_file((self.tmp_dir, "somecode", "doc.txt"), "#")
      self.write_file((self.tmp_dir, "somecode", "doc.dat"), "#")
  
      # adding some data in data_files
      data_dir = join(self.tmp_dir, "data")
      os.mkdir(data_dir)
      self.write_file((data_dir, "data.dt"), "#")
      some_dir = join(self.tmp_dir, "some")
      os.mkdir(some_dir)
      # make sure VCS directories are pruned (#14004)
      hg_dir = join(self.tmp_dir, ".hg")
      os.mkdir(hg_dir)
      self.write_file((hg_dir, "last-message.txt"), "#")
      # a buggy regex used to prevent this from working on windows (#6884)
      self.write_file((self.tmp_dir, "buildout.cfg"), "#")
      self.write_file((self.tmp_dir, "inroot.txt"), "#")
      self.write_file((some_dir, "file.txt"), "#")
      self.write_file((some_dir, "other_file.txt"), "#")
  
      dist.data_files = [
          (
              "data",
              [
                  "data/data.dt",
                  "buildout.cfg",
                  "inroot.txt",
                  "notexisting",
              ],
          ),
          "some/file.txt",
          "some/other_file.txt",
      ]
  
      # adding a script
      script_dir = join(self.tmp_dir, "scripts")
      os.mkdir(script_dir)
      self.write_file((script_dir, "script.py"), "#")
      dist.scripts = [join("scripts", "script.py")]
  
      cmd.formats = ["zip"]
      cmd.use_defaults = True
  
      cmd.ensure_finalized()
      cmd.run()
  
      # now let's check what we have
      dist_folder = join(self.tmp_dir, "dist")
      files = os.listdir(dist_folder)
      self.assertEqual(files, ["fake-1.0.zip"])
  
      zip_file = zipfile.ZipFile(join(dist_folder, "fake-1.0.zip"))
      try:
          content = zip_file.namelist()
      finally:
          zip_file.close()
  
      # making sure everything was added
      expected = [
          "",
          "PKG-INFO",
          "README",
          "buildout.cfg",
          "data/",
          "data/data.dt",
          "inroot.txt",
          "scripts/",
          "scripts/script.py",
          "setup.py",
          "some/",
          "some/file.txt",
          "some/other_file.txt",
          "somecode/",
          "somecode/__init__.py",
          "somecode/doc.dat",
          "somecode/doc.txt",
      ]
      self.assertEqual(
          sorted(content), ["fake-1.0/" + x for x in expected]
      )
  
      # checking the MANIFEST
      f = open(join(self.tmp_dir, "MANIFEST"))
      try:
          manifest = f.read()
      finally:
          f.close()
      self.assertEqual(manifest, MANIFEST % {"sep": os.sep})
  
imports: import os
  import tarfile
  import unittest
  import warnings
  import zipfile
  from os.path import join
  from textwrap import dedent
  from test.test_support import captured_stdout, check_warnings, run_unittest
  from distutils.command.sdist import sdist, show_formats
  from distutils.core import Distribution
  from distutils.tests.test_config import PyPIRCCommandTestCase
  from distutils.errors import DistutilsOptionError
  from distutils.spawn import find_executable
  from distutils.log import WARN
  from distutils.filelist import FileList
  from distutils.archive_util import ARCHIVE_FORMATS
label_desc: Use image node_id 7 for calling the SDistTestCase obj's underlying member method code with example usage: obj.test_add_defaults() without return types