def helper_run_invalid(self, filename, line, expect_str): input_path = os.path.join(self.test_files, filename) sys.argv.extend(['-i', input_path]) with open(input_path, 'r') as input_file: sa = SyntaxAnalyzer(input_file, CompilersMain.get_args()) with self.assertRaises(CompilerExceptions.CSyntaxError) as ex: sa.r_Rat18F() print(ex.exception) self.assertEqual(ex.exception.token.line, line) if expect_str is not None: self.assertEqual(ex.exception.expect, expect_str)
def helper_run_valid(self, file_path): sys.argv.extend(['-i', file_path]) with open(file_path, 'r') as input_file: sa = SyntaxAnalyzer(input_file, CompilersMain.get_args()) sa.r_Rat18F()