-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestProcess.py
More file actions
61 lines (44 loc) · 1.91 KB
/
testProcess.py
File metadata and controls
61 lines (44 loc) · 1.91 KB
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
import unittest
import process
class TestProcess(unittest.TestCase):
def test_replace_symbols_pi(self):
text = process._replace_symbols("π")
self.assertEqual(text, "3.141592653589793")
def test_replace_symbols_e(self):
text = process._replace_symbols("℮")
self.assertEqual(text, "2.718281828459045")
def test_needs_processing_empty(self):
needs_processing = process._needs_processing("")
self.assertFalse(needs_processing)
def test_needs_processing_plus(self):
needs_processing = process._needs_processing("1+2")
self.assertTrue(needs_processing)
def test_needs_processing_minus(self):
needs_processing = process._needs_processing("1-2")
self.assertTrue(needs_processing)
def test_needs_processing_times(self):
needs_processing = process._needs_processing("1*2")
self.assertTrue(needs_processing)
def test_needs_processing_divide(self):
needs_processing = process._needs_processing("1/2")
self.assertTrue(needs_processing)
def test_needs_processing_power(self):
needs_processing = process._needs_processing("1^2")
self.assertTrue(needs_processing)
def test_get_operation_plus(self):
operation = process._get_operation("1+2-3")
self.assertEqual(operation, "+")
def test_get_operation_minus(self):
operation = process._get_operation("1-2+3")
self.assertEqual(operation, "-")
def test_get_operation_times(self):
operation = process._get_operation("1*2+3-4/5")
self.assertEqual(operation, "*")
def test_get_operation_divide(self):
operation = process._get_operation("1/2+3-4*5")
self.assertEqual(operation, "/")
def test_get_operation_power(self):
operation = process._get_operation("1^2+3-4*5/6")
self.assertEqual(operation, "^")
if __name__ == '__main__':
unittest.main()