def load_test_cases(): base_path = os.path.dirname(__file__) test_case_path = os.path.join(base_path, "test_cases") test_case_files = os.listdir(test_case_path) test_cases = [] for fname in test_case_files: if not fname.endswith(".py"): continue fullpath = os.path.join(test_case_path, fname) data = open(fullpath).read() codes, messages = extract_expected_errors(data) test_cases.append((fullpath, codes, messages)) return test_cases
def load_test_cases(): base_path = os.path.dirname(__file__) test_case_path = os.path.join(base_path, "test_cases") test_case_files = os.listdir(test_case_path) test_cases = [] for fname in test_case_files: if not fname.endswith(".py"): continue fullpath = os.path.join(test_case_path, fname) data = open(fullpath).read() tree = ast.parse(data, fullpath) expected = extract_expected_errors(data) test_cases.append((tree, fullpath, expected)) return test_cases