Esempio n. 1
0
 def setUp(self):
     StreamStdoutTestCase.setUp(self)
     self.option = parse_args("app")
     self.foo = FunctionInfo("foo", 'FILENAME', 100)
     self.fileSummary = FileInformation("FILENAME", 123, [self.foo])
     self.extensions = get_extensions([])
     self.scheme = OutputScheme(self.extensions)
Esempio n. 2
0
 def test_override(self):
     args = parse_args(["lizard", "--output_file test_file.html", "--xml"])
     self.assertEqual(print_xml, args.printer)
Esempio n. 3
0
 def test_will_include_ext_args(self):
     options = parse_args(['lizard', '--ND', '2', '-End'])
     self.assertEqual(2, options.ND)
Esempio n. 4
0
 def test_sorting_factor_does_not_exist_error_message_with_ext(self, mock_stderr, mock_exit):
     options = parse_args(['lizard', '-sdoesnotexist', '-End'])
     self.assertEqual("Wrong field name 'doesnotexist'.\nCandidates are: nloc, cyclomatic_complexity, token_count, parameter_count, length, max_nesting_depth, location\n", mock_stderr.getvalue())
Esempio n. 5
0
 def test_arguments(self):
     options = parse_args(['lizard', '-a123'])
     self.assertEqual(123, options.thresholds['parameter_count'])
Esempio n. 6
0
 def test_ccn(self):
     options = parse_args(['lizard', '-C123'])
     self.assertEqual(123, options.thresholds['cyclomatic_complexity'])
Esempio n. 7
0
 def test_threshold(self):
     options = parse_args(['lizard', '-Tnloc=123'])
     self.assertEqual(123, options.thresholds['nloc'])
Esempio n. 8
0
 def test_default_sorting(self):
     options = parse_args(['lizard'])
     self.assertEqual(0, len(options.sorting))
Esempio n. 9
0
 def test_sorting_factor_does_not_exist_error_message_with_ext(
         self, mock_stderr, mock_exit):
     options = parse_args(['lizard', '-sdoesnotexist', '-End'])
     self.assertEqual(
         "Wrong field name 'doesnotexist'.\nCandidates are: nloc, cyclomatic_complexity, token_count, parameter_count, length, max_nesting_depth, location\n",
         mock_stderr.getvalue())
Esempio n. 10
0
 def test_unknlown_argument_exit(self, _, mock_exit):
     options = parse_args(['lizard', '--unkown'])
     mock_exit.assert_called_with(2)
Esempio n. 11
0
 def test_arguments(self):
     options = parse_args(['lizard', '-a123'])
     self.assertEqual(123, options.thresholds['parameter_count'])
Esempio n. 12
0
 def test_length(self):
     options = parse_args(['lizard', '-L123'])
     self.assertEqual(123, options.thresholds['length'])
Esempio n. 13
0
 def setUp(self):
     StreamStdoutTestCase.setUp(self)
     self.option = parse_args("app")
     self.foo = FunctionInfo("foo", 'FILENAME', 100)
     fileSummary = FileInformation("FILENAME", 123, [self.foo])
     self.scheme = Mock()
Esempio n. 14
0
 def test_short(self):
     args = parse_args(["lizard", "-o test_file"])
     self.assertEqual("test_file", args.output_file.strip())
Esempio n. 15
0
 def test_ccn(self):
     options = parse_args(['lizard', '-C123'])
     self.assertEqual(123, options.thresholds['cyclomatic_complexity'])
Esempio n. 16
0
 def test_sorting_factor_does_not_exist1(self, _, mock_exit):
     options = parse_args(['lizard', '-Tdoesnotexist=3'])
     mock_exit.assert_called_with(2)
Esempio n. 17
0
 def test_should_use_current_folder_as_default_path(self):
     options = parse_args(['lizard'])
     self.assertEqual(['.'], options.paths)
Esempio n. 18
0
 def test_will_include_ext_args(self):
     options = parse_args(['lizard', '--ND', '2', '-End'])
     self.assertEqual(2, options.ND)
Esempio n. 19
0
 def test_sorting_factor(self):
     options = parse_args(['lizard', '-snloc'])
     self.assertEqual("nloc", options.sorting[0])
Esempio n. 20
0
 def test_should_use_current_folder_as_default_path(self):
     options = parse_args(['lizard'])
     self.assertEqual(['.'], options.paths)
Esempio n. 21
0
 def test_more_threshold(self):
     options = parse_args(['lizard', '-Tnloc=123', '-T length = 300'])
     self.assertEqual(300, options.thresholds['length'])
Esempio n. 22
0
 def test_default_sorting(self):
     options = parse_args(['lizard'])
     self.assertEqual(0, len(options.sorting))
Esempio n. 23
0
 def test_length(self):
     options = parse_args(['lizard', '-L123'])
     self.assertEqual(123, options.thresholds['length'])
Esempio n. 24
0
 def test_sorting_factor(self):
     options = parse_args(['lizard', '-snloc'])
     self.assertEqual("nloc", options.sorting[0])
Esempio n. 25
0
 def test_unknlown_argument_exit(self, _, mock_exit):
     options = parse_args(['lizard', '--unkown'])
     mock_exit.assert_called_with(2)
Esempio n. 26
0
 def test_threshold(self):
     options = parse_args(['lizard', '-Tnloc=123'])
     self.assertEqual(123, options.thresholds['nloc'])
Esempio n. 27
0
 def test_sorting_factor_does_not_exist1(self, _, mock_exit):
     options = parse_args(['lizard', '-Tdoesnotexist=3'])
     mock_exit.assert_called_with(2)
Esempio n. 28
0
 def test_more_threshold(self):
     options = parse_args(['lizard', '-Tnloc=123', '-T length = 300'])
     self.assertEqual(300, options.thresholds['length'])
Esempio n. 29
0
 def setUp(self):
     StreamStdoutTestCase.setUp(self)
     self.option = parse_args("app")
     self.foo = FunctionInfo("foo", 'FILENAME', 100)
     fileSummary = FileInformation("FILENAME", 123, [self.foo])
     self.scheme = Mock()
Esempio n. 30
0
 def test_standalone(self):
     args = parse_args(["lizard", "--output_file", "test_file.html"])
     self.assertEqual(html_output, args.printer)