示例#1
0
    def test_pop_not_empty(self):
        stack = Stack()
        stack.stack = [1, 2, 3]

        self.assertEqual(1, stack.pop())
        self.assertEqual(2, len(stack.stack))
示例#2
0
    def test_peek_is_not_empty(self):
        stack = Stack()
        stack.stack = ['bananas']

        self.assertEqual('bananas', stack.peek())
示例#3
0
    def test_is_empty_is_false(self):
        stack = Stack()
        stack.stack = [1, 2, 3]

        self.assertFalse(stack.is_empty())