Пример #1
0
def test_current():
    stack = Stack()
    assert_true(stack.current is _undefined)
    stack.push('foo')
    assert_equal(stack.current, 'foo')
    stack.pop()
    assert_true(stack.current is _undefined)
    stack.push('foo, part 2')
    stack.flush()
    assert_true(stack.current is _undefined)
    stack = Stack(['foo', 'bar', 'baz'])
    assert_equal(stack.current, 'baz')
Пример #2
0
def test_current():
    stack = Stack()
    assert_true(stack.current is _undefined)
    stack.push('foo')
    assert_equal(stack.current, 'foo')
    stack.pop()
    assert_true(stack.current is _undefined)
    stack.push('foo, part 2')
    stack.flush()
    assert_true(stack.current is _undefined)
    stack = Stack(['foo', 'bar', 'baz'])
    assert_equal(stack.current, 'baz')
Пример #3
0
def test_pop():
    stack = Stack(['foo'])
    assert_equal(stack.current, 'foo')
    assert_equal(stack.pop(), 'foo')
    assert_equal(stack.current, _undefined)
    assert_raises(StackEmpty, stack.pop)
Пример #4
0
def test_pop():
    stack = Stack(['foo'])
    assert_equal(stack.current, 'foo')
    assert_equal(stack.pop(), 'foo')
    assert_equal(stack.current, _undefined)
    assert_raises(StackEmpty, stack.pop)