def test_all(self): stack = TripleStack() for i in range(50): stack.push(i % 3, i % 3) for i in range(20): stack.pop(i % 3) for i in range(10): stack.push(1, 1) for i in range(5): stack.pop(2) print stack
def test_pop_and_peek(self): stack = TripleStack() for i in range(10): stack.push(i % 3, i) for i in range(9, -1, -1): self.assertEquals(stack.pop(i % 3), i) self.assertRaises(KeyError, stack.pop, 0) self.assertEquals(stack.peek(0), None)