From c10ab169f6e74974ec0d8dea174edc17fa020d9a Mon Sep 17 00:00:00 2001 From: sifat Date: Tue, 31 Oct 2023 11:03:49 -0700 Subject: [PATCH] fix test_code 2 (#718) --- .github/test_code.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/test_code.py b/.github/test_code.py index 92401656..32e8da83 100644 --- a/.github/test_code.py +++ b/.github/test_code.py @@ -173,7 +173,8 @@ def analyze_code(self) -> None: # change all header to self.code = re.sub(r'#include\s+<\w+>', '#include ', self.code) - # change all header to + if not self.code.startswith('#include '): + self.code = '#include \n' + self.code def get_command(self): if sys.platform == 'win32': @@ -263,9 +264,9 @@ def fix_path(path): class Test: - def __init__(self, path) -> None: + def __init__(self, path:str) -> None: self.readme_path = fix_path(path) - self.codes = self.get_codes() if path.endswith('.md') else self.get_code(path) + self.codes = self.get_codes() if path.lower().endswith('.md') else self.get_code(path) Log.debug("Testing code in ", path) def get_codes(self): @@ -491,7 +492,6 @@ def get_hash(self, file, repo): if __name__ == "__main__": curent_dir = os.getcwd() - cm = CompareGitRepo( - curent_dir, "https://github.com/shhossain/computer_science") + cm = CompareGitRepo(curent_dir, "https://github.com/shhossain/computer_science") modified_files = cm.compare() test_all(modified_files)