-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStackTest.py
More file actions
29 lines (26 loc) · 802 Bytes
/
Copy pathStackTest.py
File metadata and controls
29 lines (26 loc) · 802 Bytes
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
from Stack import Stack;
import unittest
class TestStackMethods(unittest.TestCase):
def test_stack(self):
stack = Stack();
stack.push(4);
self.assertEqual(stack.peek(), 4);
stack.push(2);
self.assertEqual(stack.peek(), 2);
stack.push(-1);
self.assertEqual(stack.peek(), -1);
stack.push("A");
self.assertEqual(stack.peek(), -1);
stack.pop();
self.assertEqual(stack.peek(), 2);
stack.pop();
self.assertEqual(stack.peek(), 4);
stack.push(10);
self.assertEqual(stack.peek(), 10);
stack.push(5);
self.assertEqual(stack.peek(), 5);
stack.pop();
self.assertEqual(stack.peek(), 10);
stack.pop();
if __name__ == '__main__':
unittest.main()