示例#1
0
文件: test_stack.py 项目: lerouxb/ni
def test_stack_limit_reached():
    s = Stack(5)
    for x in xrange(5):
        s.push(x)
    assert len(s) == 5
    s.push(5) # 0..4 and now 5
    assert len(s) == 5 # length is still 5
示例#2
0
文件: test_stack.py 项目: lerouxb/ni
def test_stack_clear():
    s = Stack()
    s.push(1)
    s.clear()
    assert len(s) == 0
示例#3
0
文件: test_stack.py 项目: lerouxb/ni
def test_stack_push_pop_pop():
    s = Stack()
    s.push(1)
    s.pop()
    assert s.pop() == None # is this really the right thing to do?
示例#4
0
文件: test_stack.py 项目: lerouxb/ni
def test_stack_push_pop():
    s = Stack()
    s.push(1)
    assert s.pop() == 1
    assert len(s) == 0
示例#5
0
文件: test_stack.py 项目: lerouxb/ni
def test_stack_last():
    s = Stack()
    s.push(1)
    assert s.last() == 1
    assert len(s) == 1 # the value is still on the stack
示例#6
0
文件: test_stack.py 项目: lerouxb/ni
def test_stack_push():
    s = Stack()
    s.push(1)
    assert len(s) == 1