Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_complexity_number(snippet, strio, max=0):
"""Get the complexity number from the printed string."""
# Report from the lowest complexity number.
get_code_complexity(snippet, max)
strio_val = strio.getvalue()
if strio_val:
return int(strio_val.split()[-1].strip("()"))
else:
return None
def test_print_message(self):
get_code_complexity(sequential, 0)
printed_message = self.strio.getvalue()
self.assertEqual(printed_message,
"stdin:1:1: C901 'f' is too complex (1)\n")