예제 #1
0
 def test_push2_pop2_size(self):
     s = Stack()
     s.push("Royce")
     s.push("Toan")
     s.pop()
     s.pop()
     self.assertEqual(0, s.size())
예제 #2
0
 def test_peek_empty(self):
     s = Stack()
     self.assertRaises(IndexError, s.peek)
예제 #3
0
 def test_push1_size(self):
     item = 5
     s = Stack()
     s.push(item)
     self.assertEqual(1, s.size())
예제 #4
0
 def test_peek_push3_pop1(self):
     s = Stack()
     s.push(1)
     s.push(123)
     s.push(3)
     s.pop()
     self.assertEqual(123, s.peek())
예제 #5
0
 def test_peek_push1(self):
     s = Stack()
     s.push(13)
     self.assertEqual(13, s.peek())
예제 #6
0
 def test_isEmpty_push1_pop1(self):
     s = Stack()
     s.push(1)
     s.pop()
     self.assertEqual(True, s.isEmpty())
예제 #7
0
 def test_isEmpty_push1(self):
     s = Stack()
     s.push(5)
     self.assertEqual(False, s.isEmpty())
예제 #8
0
 def test_isEmpty_init(self):
     s = Stack()
     self.assertEqual(True, s.isEmpty())
예제 #9
0
 def test_push2_pop2_value(self):
     s = Stack()
     s.push("Royce")
     s.push("Toan")
     s.pop()
     self.assertEqual("Royce", s.pop())
예제 #10
0
 def test_stack_init(self):
     s = Stack()
     self.assertEqual(0, s.size())
예제 #11
0
 def test_push2_pop1_value(self):
     s = Stack()
     s.push(8)
     s.push(9)
     self.assertEqual(9, s.pop())
예제 #12
0
 def test_push2_pop1_size(self):
     s = Stack()
     s.push(5)
     s.push(6)
     s.pop()
     self.assertEqual(1, s.size())
예제 #13
0
 def test_push2_items(self):
     s = Stack()
     s.push(5)
     s.push(6)
     self.assertEqual([5, 6], s.items)
예제 #14
0
 def test_push2_size(self):
     s = Stack()
     s.push(5)
     s.push(6)
     self.assertEqual(2, s.size())
예제 #15
0
 def test_push1_items(self):
     s = Stack()
     s.push(5)
     self.assertEqual([5], s.items)