コード例 #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