Ejemplo n.º 1
0
    def test_init(self):
        """Test initialization"""

        mod_analyzer = ModuleAnalyzer()
        self.assertIsInstance(mod_analyzer, ModuleAnalyzer)
        self.assertIsInstance(mod_analyzer.analyzer, PyLint)

        mod_analyzer = ModuleAnalyzer(kind=FLAKE8)
        self.assertIsInstance(mod_analyzer, ModuleAnalyzer)
        self.assertIsInstance(mod_analyzer.analyzer, Flake8)
Ejemplo n.º 2
0
    def test_analyze(self):
        """Test whether the analyze method works"""

        module_path = os.path.join(self.tmp_path, 'graaltest', 'perceval')
        mod_analyzer = ModuleAnalyzer()
        result = mod_analyzer.analyze(module_path)

        self.assertNotIn('modules', result)
        self.assertIn('quality', result)
        self.assertTrue(type(result['quality']), str)
        self.assertIn('num_modules', result)
        self.assertTrue(type(result['num_modules']), int)
        self.assertIn('warnings', result)
        self.assertTrue(type(result['warnings']), int)
Ejemplo n.º 3
0
    def test_init(self):
        """Test initialization"""

        mod_analyzer = ModuleAnalyzer()

        self.assertIsInstance(mod_analyzer, ModuleAnalyzer)
        self.assertIsInstance(mod_analyzer.lint, Lint)