Пример #1
0
 def test_whitelist(self, mock_exit):
     fun = FunctionInfo("foo", 100)
     fun.cyclomatic_complexity = 16
     file_infos = [FileInformation('f1.c', 1, [fun])]
     option = Mock(CCN=15, number = 0, extensions=[], whitelist='foo')
     print_result(file_infos, option)
     self.assertEqual(0, mock_exit.call_count)
Пример #2
0
 def test_print_extension_results(self):
     file_infos = []
     extension = Mock(FUNCTION_CAPTION = "")
     del extension.AVERAGE_CAPTION
     option = Mock(CCN=15, thresholds={}, number = 0, extensions = [extension], whitelist='')
     print_result(file_infos, option, OutputScheme(option.extensions))
     self.assertEqual(1, extension.print_result.call_count)
Пример #3
0
 def test_exit_with_non_zero_when_more_warning_than_ignored_number(self, mock_exit):
     fun = FunctionInfo("foo", 100)
     fun.cyclomatic_complexity = 16
     file_infos = [FileInformation('f1.c', 1, [fun])]
     option = Mock(CCN=15, number = 0, extensions=[], whitelist='')
     print_result(file_infos, option)
     mock_exit.assert_called_with(1)
Пример #4
0
    def test_print_extension_results(self):

        file_infos = []
        extension = Mock()
        option = Mock(CCN=15, number = 0, extensions = [extension], whitelist='')
        print_result(file_infos, option)
        self.assertEqual(1, extension.print_result.call_count)
Пример #5
0
 def test_print_result(self, mock_exit):
     file_infos = [FileInformation('f1.c', 1, []), FileInformation('f2.c', 1, [])]
     option = Mock(CCN=15, number = 0, extensions=[], whitelist='')
     print_result(file_infos, option)
     self.assertEqual(0, mock_exit.call_count)
Пример #6
0
 def test_print_extension_results(self):
     file_infos = []
     extension = Mock()
     option = Mock(CCN=15, number = 0, extensions = [extension], whitelist='')
     print_result(file_infos, option)
     self.assertEqual(1, extension.print_result.call_count)
Пример #7
0
 def test_null_result(self):
     file_infos = [FileInformation('f1.c', 1, []), None]
     option = Mock(CCN=15, number = 0, extensions=[], whitelist='')
     print_result(file_infos, option)
Пример #8
0
def print_result_with_scheme(result, option):
    return print_result(result, option, OutputScheme(option.extensions), AllResult)
Пример #9
0
def print_result_with_scheme(result, option):
    return print_result(result, option, OutputScheme(option.extensions),
                        AllResult)
Пример #10
0
 def check_whitelist(self, script, mock_open, mock_isfile):
     mock_isfile.return_value = True
     mock_open.return_value.read.return_value = script
     file_infos = [FileInformation('f1.c', 1, [self.foo])]
     option = Mock(CCN=15, number = 0, arguments=100, length=1000, extensions=[])
     print_result(file_infos, option)
Пример #11
0
 def test_should_not_print_extension_results_when_not_implemented(self):
     file_infos = []
     option = Mock(CCN=15, number = 0, extensions = [object()], whitelist='')
     print_result(file_infos, option)
Пример #12
0
 def test_null_result(self):
     file_infos = [FileInformation('f1.c', 1, []), None]
     option = Mock(CCN=15, number = 0)
     print_result(file_infos, option)