Exemple #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)
Exemple #2
0
 def test_override(self):
     args = parse_args(["lizard", "--output_file test_file.html", "--xml"])
     self.assertEqual(print_xml, args.printer)
Exemple #3
0
 def test_will_include_ext_args(self):
     options = parse_args(['lizard', '--ND', '2', '-End'])
     self.assertEqual(2, options.ND)
Exemple #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())
Exemple #5
0
 def test_arguments(self):
     options = parse_args(['lizard', '-a123'])
     self.assertEqual(123, options.thresholds['parameter_count'])
Exemple #6
0
 def test_ccn(self):
     options = parse_args(['lizard', '-C123'])
     self.assertEqual(123, options.thresholds['cyclomatic_complexity'])
Exemple #7
0
 def test_threshold(self):
     options = parse_args(['lizard', '-Tnloc=123'])
     self.assertEqual(123, options.thresholds['nloc'])
Exemple #8
0
 def test_default_sorting(self):
     options = parse_args(['lizard'])
     self.assertEqual(0, len(options.sorting))
Exemple #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())
Exemple #10
0
 def test_unknlown_argument_exit(self, _, mock_exit):
     options = parse_args(['lizard', '--unkown'])
     mock_exit.assert_called_with(2)
Exemple #11
0
 def test_arguments(self):
     options = parse_args(['lizard', '-a123'])
     self.assertEqual(123, options.thresholds['parameter_count'])
Exemple #12
0
 def test_length(self):
     options = parse_args(['lizard', '-L123'])
     self.assertEqual(123, options.thresholds['length'])
Exemple #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()
Exemple #14
0
 def test_short(self):
     args = parse_args(["lizard", "-o test_file"])
     self.assertEqual("test_file", args.output_file.strip())
Exemple #15
0
 def test_ccn(self):
     options = parse_args(['lizard', '-C123'])
     self.assertEqual(123, options.thresholds['cyclomatic_complexity'])
Exemple #16
0
 def test_sorting_factor_does_not_exist1(self, _, mock_exit):
     options = parse_args(['lizard', '-Tdoesnotexist=3'])
     mock_exit.assert_called_with(2)
Exemple #17
0
 def test_should_use_current_folder_as_default_path(self):
     options = parse_args(['lizard'])
     self.assertEqual(['.'], options.paths)
Exemple #18
0
 def test_will_include_ext_args(self):
     options = parse_args(['lizard', '--ND', '2', '-End'])
     self.assertEqual(2, options.ND)
Exemple #19
0
 def test_sorting_factor(self):
     options = parse_args(['lizard', '-snloc'])
     self.assertEqual("nloc", options.sorting[0])
Exemple #20
0
 def test_should_use_current_folder_as_default_path(self):
     options = parse_args(['lizard'])
     self.assertEqual(['.'], options.paths)
Exemple #21
0
 def test_more_threshold(self):
     options = parse_args(['lizard', '-Tnloc=123', '-T length = 300'])
     self.assertEqual(300, options.thresholds['length'])
Exemple #22
0
 def test_default_sorting(self):
     options = parse_args(['lizard'])
     self.assertEqual(0, len(options.sorting))
Exemple #23
0
 def test_length(self):
     options = parse_args(['lizard', '-L123'])
     self.assertEqual(123, options.thresholds['length'])
Exemple #24
0
 def test_sorting_factor(self):
     options = parse_args(['lizard', '-snloc'])
     self.assertEqual("nloc", options.sorting[0])
Exemple #25
0
 def test_unknlown_argument_exit(self, _, mock_exit):
     options = parse_args(['lizard', '--unkown'])
     mock_exit.assert_called_with(2)
Exemple #26
0
 def test_threshold(self):
     options = parse_args(['lizard', '-Tnloc=123'])
     self.assertEqual(123, options.thresholds['nloc'])
Exemple #27
0
 def test_sorting_factor_does_not_exist1(self, _, mock_exit):
     options = parse_args(['lizard', '-Tdoesnotexist=3'])
     mock_exit.assert_called_with(2)
Exemple #28
0
 def test_more_threshold(self):
     options = parse_args(['lizard', '-Tnloc=123', '-T length = 300'])
     self.assertEqual(300, options.thresholds['length'])
Exemple #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()
Exemple #30
0
 def test_standalone(self):
     args = parse_args(["lizard", "--output_file", "test_file.html"])
     self.assertEqual(html_output, args.printer)