-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinguistic_analysis_tests.py
55 lines (39 loc) · 1.35 KB
/
linguistic_analysis_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 23 18:53:50 2017
Unit test for linguistic_analysis.py
@author: duc
"""
import unittest
import linguistic_analysis as la
tweets = [
"Is this not a question?! Interactive introduction reference information",
"Sure! Why not?"
]
norm = [
[
["is", "this", "not", "a", "question"],
["interactive", "introduction", "reference", "information"]
],
[["sure", "why", "not"]]
]
class LinguisticAnalysisTests(unittest.TestCase):
def test_average_question_marks(self):
self.assertEqual(la.get_average_question_marks(tweets), 1)
def test_average_exclamation_marks(self):
self.assertEqual(la.get_average_exclamation_marks(tweets), 1)
def test_average_word_characters(self):
number = la.get_average_word_characters(norm)
self.assertEqual(round(number), 6)
def test_average_word_syllables(self):
number = la.get_average_word_syllables(norm)
self.assertEqual(round(number), 2)
def test_average_sentence_length(self):
number = la.get_average_sentence_length(norm)
self.assertEqual(round(number), 4)
def test_average_tweet_length(self):
number = la.get_average_tweet_length(norm)
self.assertEqual(round(number), 6)
if __name__ == '__main__':
unittest.main()