def test_member_within_base_dir(self):
        """Test a member within the base directory."""
        with tarfile.open(self.tar_path, "w") as tar:
            tar.add(__file__, arcname="safe_path.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, "safe_path.txt")
Test a member within the base directory.
keras/src/utils/file_utils_test.py