def test_init(self): """Test initialization""" repo_analyzer = RepositoryAnalyzer() self.assertIsInstance(repo_analyzer, RepositoryAnalyzer) self.assertIsInstance(repo_analyzer.analyzer, Linguist) repo_analyzer = RepositoryAnalyzer(kind=CLOC) self.assertIsInstance(repo_analyzer, RepositoryAnalyzer) self.assertIsInstance(repo_analyzer.analyzer, Cloc)
def test_analyze(self): """Test whether the analyze method works""" repo_analyzer = RepositoryAnalyzer() result = repo_analyzer.analyze(self.origin_path) self.assertNotIn('breakdown', result) self.assertIn('Python', result) self.assertTrue(type(result['Python']), float) repo_analyzer = RepositoryAnalyzer(kind=CLOC) results = repo_analyzer.analyze(self.origin_path) result = results[next(iter(results))] self.assertIn('blanks', result) self.assertTrue(type(result['blanks']), int) self.assertIn('comments', result) self.assertTrue(type(result['comments']), int) self.assertIn('loc', result) self.assertTrue(type(result['loc']), int) self.assertIn('total_files', result) self.assertTrue(type(result['total_files']), int)