CoolFace
Apppublic

chendl/compositional_test

sourceHugging Faceupdated 3y agoView on Hugging Face
1likes
check_doctest_list.py36 linesDownload Raw Back to utils
1# coding=utf-82# Copyright 2023 The HuggingFace Inc. team.3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8#     http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15 16import os17 18 19# All paths are set with the intent you should run this script from the root of the repo with the command20# python utils/check_doctest_list.py21REPO_PATH = "."22 23 24if __name__ == "__main__":25    doctest_file_path = os.path.join(REPO_PATH, "utils/documentation_tests.txt")26    non_existent_paths = []27    with open(doctest_file_path) as fp:28        for line in fp:29            line = line.strip()30            path = os.path.join(REPO_PATH, line)31            if not (os.path.isfile(path) or os.path.isdir(path)):32                non_existent_paths.append(line)33    if len(non_existent_paths) > 0:34        non_existent_paths = "\n".join(non_existent_paths)35        raise ValueError(f"`utils/documentation_tests.txt` contains non-existent paths:\n{non_existent_paths}")36