-
Notifications
You must be signed in to change notification settings - Fork 46
/
TestProject.py
63 lines (51 loc) · 2.52 KB
/
TestProject.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
53
54
55
56
57
58
59
60
61
62
63
from unittest import TestCase
from Main2 import analysis_text
class testRunAnalys(TestCase):
def test1(self):
self.assertEqual(1, 1)
class testsetResult(TestCase):
def test_setAll(self):
myanalysis = analysis_text()
myanalysis.__init__()
myanalysis.setResult("neg", 0.5)
myanalysis.setResult("pos", 0.2)
myanalysis.setResult("neu", 0.3)
self.assertEqual(myanalysis.negativeLabel.cget("text"), "Отрицательно : 0.5 % \n")
self.assertEqual(myanalysis.positiveLabel.cget("text"), "Положительно : 0.2 % \n")
self.assertEqual(myanalysis.neutralLabel.cget("text"), "Нейтрально : 0.3 % \n")
def test_setAll_0(self):
myanalysis = analysis_text()
myanalysis.__init__()
myanalysis.setResult("neg", 0)
myanalysis.setResult("pos", 0)
myanalysis.setResult("neu", 0)
self.assertEqual(myanalysis.negativeLabel.cget("text"), "Отрицательно : 0 % \n")
self.assertEqual(myanalysis.positiveLabel.cget("text"), "Положительно : 0 % \n")
self.assertEqual(myanalysis.neutralLabel.cget("text"), "Нейтрально : 0 % \n")
def test_setOne(self):
myanalysis = analysis_text()
myanalysis.__init__()
myanalysis.setResult("neg", 0.1)
self.assertEqual(myanalysis.negativeLabel.cget("text"), "Отрицательно : 0.1 % \n")
self.assertEqual(myanalysis.positiveLabel.cget("text"), "")
self.assertEqual(myanalysis.neutralLabel.cget("text"), "")
def test_NUL(self):
myanalysis = analysis_text()
myanalysis.__init__()
self.assertEqual(myanalysis.negativeLabel.cget("text"), "")
self.assertEqual(myanalysis.positiveLabel.cget("text"), "")
self.assertEqual(myanalysis.neutralLabel.cget("text"), "")
def test_setErrorType(self):
myanalysis = analysis_text()
myanalysis.__init__()
myanalysis.setResult("error", 0.1)
self.assertEqual(myanalysis.negativeLabel.cget("text"), "")
self.assertEqual(myanalysis.positiveLabel.cget("text"), "")
self.assertEqual(myanalysis.neutralLabel.cget("text"), "")
def test_setErrorValue(self):
myanalysis = analysis_text()
myanalysis.__init__()
myanalysis.setResult("pos", "abc")
self.assertEqual(myanalysis.negativeLabel.cget("text"), "")
self.assertEqual(myanalysis.positiveLabel.cget("text"), "")
self.assertEqual(myanalysis.neutralLabel.cget("text"), "")