def check_code(code, ignore=(), complexity=-1): warning = flakey.check(code, '<stdin>') _set_alt(warning) warnings = flakey.print_messages(warning, ignore=ignore, code=code) warnings += pep8style.input_file('-', lines=code.split('\n')) if complexity > -1: warnings += mccabe.get_code_complexity(code, complexity) return warnings
def test_import_exception_in_scope(self): warnings = check(code_import_exception, "(stdin)") warnings = print_messages(warnings) self.assertEqual(warnings, 0)
def test_exception(self): for c in (code, code2, code3): warnings = check(code, "(stdin)") warnings = print_messages(warnings) self.assertEqual(warnings, 0)