示例#1
0
def test_pseudo_enqueue():
    sleft = Stack()
    sright = Stack()
    q = PseudoQueue(sleft, sright)
    q.enqueue("apple")
    actual = q.left.top.value
    excepted = "apple"
    assert actual == excepted
示例#2
0
def test_pseudo_dequeue():
    sleft = Stack()
    sright = Stack()
    q = PseudoQueue(sleft, sright)
    q.enqueue("apple")
    q.enqueue("bananas")
    q.enqueue("cucumbers")
    actual = q.dequeue()
    excepted = "apple"
    assert actual == excepted
示例#3
0
def test_pseudo_enqueue_multi():
    sleft = Stack()
    sright = Stack()
    q = PseudoQueue(sleft, sright)
    q.enqueue("apple")
    q.enqueue("bananas")
    q.enqueue("cucumbers")
    actual = q.left.top.value
    excepted = "cucumbers"
    assert actual == excepted
示例#4
0
def test_push_onto_full_queue():
    s = Stack()
    s.push("apple")
    s.push("cucumber")
    s.push("phone")
    actual = s.top.value
    excepted = "phone"
    assert actual == excepted
示例#5
0
def test_stack_has_top_queue():
    s = Stack()
    assert s.top is None
示例#6
0
def test_pseudo_has_right_queue():
    sleft = Stack()
    sright = Stack()
    q = PseudoQueue(sleft, sright)
    assert q.right.top is None
示例#7
0
def test_peek_queue():
    s = Stack()
    s.push("apple")
    actual = s.peek()
    expected = "apple"
    assert actual == expected
示例#8
0
def test_push_onto_empty_queue():
    s = Stack()
    s.push("apple")
    actual = s.top.value
    excepted = "apple"
    assert actual == excepted