def _analyse_method(method): name = method.name body = method.body complexity = comp.complexity(body) if body else 0 comp_method = Method(name, complexity) return comp_method
def test_compl_for_do_while(self): method = _METHODS_BY_NAME.get("doWhileExample") self.assertEqual(sut.complexity(method), 3)
def test_compl_for_if_elseif_example(self): method = _METHODS_BY_NAME.get("ifElseifExample") self.assertEqual(sut.complexity(method), 5)
def test_compl_for_if_in_loops(self): method = _METHODS_BY_NAME.get("ifInLoops") self.assertEqual(sut.complexity(method), 6)
def test_compl_for_switch_example(self): method = _METHODS_BY_NAME.get("switchExample") self.assertEqual(sut.complexity(method), 1)
def test_compl_for_compl_example4(self): method = _METHODS_BY_NAME.get("complExample4") self.assertEqual(sut.complexity(method), 96)