def test_symlink_within_base_dir(self):
        """Test a symlink pointing within the base directory."""
        symlink_path = os.path.join(self.base_dir, "symlink.txt")
        target_path = os.path.join(self.base_dir, "target.txt")
        with open(target_path, "w") as f:
            f.write("target")
        os.symlink(target_path, symlink_path)
        with tarfile.open(self.tar_path, "w") as tar:
            tar.add(symlink_path, arcname="symlink.txt")
        with tarfile.open(self.tar_path, "r") as tar:
            members = list(file_utils.filter_safe_paths(tar.getmembers()))
            self.assertEqual(len(members), 1)
            self.assertEqual(members[0].name, "symlink.txt")
        os.remove(symlink_path)
        os.remove(target_path)
Test a symlink pointing within the base directory.
keras/src/utils/file_utils_test.py