Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Add unit tests to the "commentAnalysis.py"
Browse files Browse the repository at this point in the history
Adds positive unit tests to the functions in the commentAnalysis.py
file
  • Loading branch information
pramodrj07 committed Jan 4, 2022
1 parent 3f9d9b0 commit b07875d
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions ml-conversational-analytic-tool/test_commentAnalysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import unittest
from commentAnalysis import CommentAnalyzer


class TestCommentAnalysis(unittest.TestCase):


def test_CommentAnalyzer_init(self):
analyzer = CommentAnalyzer(['test'])
self.assertEqual(analyzer.word_count, {'test': 0})

def test_analyze_comments(self):
analyzer = CommentAnalyzer(['test'])
result = analyzer.analyzeComment("This is a test comment")
self.assertEqual(result, {'test': 1, 'Sentiment': 0.0, 'Code Blocks': 0})

def test_preProcess(self):
analyzer = CommentAnalyzer(['test'])
result = analyzer.preProcess("This is a test comment")
self.assertEqual(result, "this is a test comment")

def test_countWords(self):
analyzer = CommentAnalyzer(['test'])
result = analyzer.countWords("This is a test comment")
self.assertEqual(result, {'test': 1})

def test_getSentiment(self):
analyzer = CommentAnalyzer(['test'])
result = analyzer.getSentiment("This is a test comment")
self.assertEqual(result, 0.0)

def test_getCodeBlockCount(self):
analyzer = CommentAnalyzer(['test'])
result = analyzer.getCodeBlockCount("This is a test comment")
self.assertEqual(result, 0)


0 comments on commit b07875d

Please sign in to comment.