コード例 #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
ファイル: test_token_stack.py プロジェクト: EnTeQuAk/dmlt
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
ファイル: test_token_stack.py プロジェクト: EnTeQuAk/dmlt
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)