code: def test_get_packages_with_dir(self):
      # Test _get_packages() with a wheel package directory
      pip_filename = "pip-20.2.2-py2.py3-none-any.whl"
  
      with tempfile.TemporaryDirectory() as tmpdir:
          self.touch(tmpdir, pip_filename)
          # not used, make sure that it's ignored
          self.touch(tmpdir, "wheel-0.34.2-py2.py3-none-any.whl")
  
          with unittest.mock.patch.object(
              ensurepip, "_PACKAGES", None
          ), unittest.mock.patch.object(
              ensurepip, "_WHEEL_PKG_DIR", tmpdir
          ):
              packages = ensurepip._get_packages()
  
          self.assertEqual(packages["pip"].version, "20.2.2")
          self.assertEqual(
              packages["pip"].wheel_path,
              os.path.join(tmpdir, pip_filename),
          )
  
          # wheel package is ignored
          self.assertEqual(sorted(packages), ["pip"])
  
imports: import contextlib
  import os
  import os.path
  import sys
  import tempfile
  import test.support
  import unittest
  import unittest.mock
  import ensurepip
  import ensurepip._uninstall
label_desc: Use image node_id 4 for calling the TestPackages obj's underlying member method code with example usage: obj.test_get_packages_with_dir() without return types