def test_sample(self): self.assertEqual(get_code_complexity(_GLOBAL, 1), 2) self.out.seek(0) res = self.out.read().strip().split('\n') wanted = ["stdin:5:1: W901 'a' is too complex (4)", "stdin:2:1: W901 'Loop 2' is too complex (2)"] self.assertEqual(res, wanted)
def test_sample(self): self.assertEqual(get_code_complexity(_GLOBAL, 1), 2) self.out.seek(0) res = self.out.read().strip().split('\n') wanted = ["stdin:5:1: 'a' is too complex (3)", 'stdin:Loop 2 is too complex (1)'] self.assertEqual(res, wanted)
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_sample(self): self.assertEqual(get_code_complexity(_GLOBAL, 1), 2) self.out.seek(0) res = self.out.read().strip().split('\n') wanted = [ "stdin:5:1: 'a' is too complex (3)", 'stdin:Loop 2 is too complex (1)' ] self.assertEqual(res, wanted)
def check_code(code, complexity=-1): warnings = pyflakes.check(code, '<stdin>') if complexity > -1: warnings += mccabe.get_code_complexity(code, complexity) return warnings
def check_code(code, complexity=-1): warnings = pyflakes.check(code, 'stdin') warnings += pep8style.input_file(StringIO(code)) if complexity > -1: warnings += mccabe.get_code_complexity(code, complexity) return warnings
def check_code(code, ignore=(), complexity=-1): warnings = pyflakes.check(code, ignore, "stdin") warnings += pep8style.input_file(None, lines=code.split("\n")) if complexity > -1: warnings += mccabe.get_code_complexity(code, complexity) return warnings