code: def testCopyDirWithAllowlistAndDenylist(self):
      old = os.path.join(self._base_dir, "old")
      self.createFiles(
          {
              "old": {
                  "file1.txt": "testing1",
                  "dir1": {
                      "file2.txt": "testing2",
                      "dir2": {"file3.txt": "testing3"},
                      "dir3": {},
                  },
              }
          }
      )
  
      with self.subTest("Allowlist filenames"):
          new1 = os.path.join(self._base_dir, "new1")
          io_utils.copy_dir(
              old, new1, allow_regex_patterns=[r"file[2-3]\.txt"]
          )
          self.assertDirectoryEqual(
              new1,
              {
                  "dir1": {
                      "file2.txt": "testing2",
                      "dir2": {"file3.txt": "testing3"},
                  }
              },
          )
  
      with self.subTest("Allowlist dir1"):
          new2 = os.path.join(self._base_dir, "new2")
          io_utils.copy_dir(old, new2, allow_regex_patterns=["dir1"])
          self.assertDirectoryEqual(
              new2,
              {
                  "dir1": {
                      "file2.txt": "testing2",
                      "dir2": {"file3.txt": "testing3"},
                      "dir3": {},
                  }
              },
          )
  
      with self.subTest("Allowlist dir2"):
          new3 = os.path.join(self._base_dir, "new3")
          io_utils.copy_dir(old, new3, allow_regex_patterns=["dir2"])
          self.assertDirectoryEqual(
              new3, {"dir1": {"dir2": {"file3.txt": "testing3"}}}
          )
  
      with self.subTest("Multiple allowlist is unioned"):
          new4 = os.path.join(self._base_dir, "new4")
          io_utils.copy_dir(
              old,
              new4,
              allow_regex_patterns=[r"file1\.txt", r"file2\.txt"],
          )
          self.assertDirectoryEqual(
              new4,
              {
                  "file1.txt": "testing1",
                  "dir1": {"file2.txt": "testing2"},
              },
          )
  
      with self.subTest("Denylist filenames"):
          new5 = os.path.join(self._base_dir, "new5")
          io_utils.copy_dir(
              old, new5, deny_regex_patterns=[r"file[2-3]\.txt"]
          )
          self.assertDirectoryEqual(
              new5,
              {
                  "file1.txt": "testing1",
                  "dir1": {"dir2": {}, "dir3": {}},
              },
          )
  
      with self.subTest("Denylist dir1"):
          new6 = os.path.join(self._base_dir, "new6")
          io_utils.copy_dir(old, new6, deny_regex_patterns=["dir1"])
          self.assertDirectoryEqual(new6, {"file1.txt": "testing1"})
  
      with self.subTest("Denylist dir2"):
          new7 = os.path.join(self._base_dir, "new7")
          io_utils.copy_dir(old, new7, deny_regex_patterns=["dir2"])
          self.assertDirectoryEqual(
              new7,
              {
                  "file1.txt": "testing1",
                  "dir1": {"file2.txt": "testing2", "dir3": {}},
              },
          )
  
      with self.subTest("Multiple denylist is unioned"):
          new8 = os.path.join(self._base_dir, "new8")
          io_utils.copy_dir(
              old,
              new8,
              deny_regex_patterns=[r"file1\.txt", r"file2\.txt"],
          )
          self.assertDirectoryEqual(
              new8,
              {
                  "dir1": {
                      "dir2": {
                          "file3.txt": "testing3",
                      },
                      "dir3": {},
                  }
              },
          )
  
      with self.subTest("Allowlist and denylist is AND clause."):
          new9 = os.path.join(self._base_dir, "new9")
          io_utils.copy_dir(
              old,
              new9,
              allow_regex_patterns=["dir1"],
              deny_regex_patterns=[r"file2\.txt"],
          )
          self.assertDirectoryEqual(
              new9,
              {
                  "dir1": {
                      "dir2": {
                          "file3.txt": "testing3",
                      },
                      "dir3": {},
                  }
              },
          )
  
imports: import os
  from unittest import mock
  import tensorflow
  from tfx.dsl.io import fileio
  from tfx.utils import io_utils
  from tensorflow.python.lib.io import file_io
label_desc: Use image node_id 13 for calling the IoUtilsTest obj's underlying member method code with example usage: obj.testCopyDirWithAllowlistAndDenylist() without return types