Пример #1
0
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
Пример #2
0
 def test_compl_for_do_while(self):
     method = _METHODS_BY_NAME.get("doWhileExample")
     self.assertEqual(sut.complexity(method), 3)
Пример #3
0
 def test_compl_for_if_elseif_example(self):
     method = _METHODS_BY_NAME.get("ifElseifExample")
     self.assertEqual(sut.complexity(method), 5)
Пример #4
0
 def test_compl_for_if_in_loops(self):
     method = _METHODS_BY_NAME.get("ifInLoops")
     self.assertEqual(sut.complexity(method), 6)
Пример #5
0
 def test_compl_for_switch_example(self):
     method = _METHODS_BY_NAME.get("switchExample")
     self.assertEqual(sut.complexity(method), 1)
Пример #6
0
 def test_compl_for_compl_example4(self):
     method = _METHODS_BY_NAME.get("complExample4")
     self.assertEqual(sut.complexity(method), 96)