def test_stack_peek_empty():
    hats = Stack()

    assert hats.peek() == 'Empty Stack'
def test_peek_stack():
    stack = Stack()
    stack.push('works')
    assert stack.peek() == 'works'
def test_push_onto_empty():
    s = Stack()
    s.push("apple")
    actual = s.top.value
    expected = "apple"
    assert actual == expected
def test_push():
    stack = Stack()
    stack.push('works')
    assert stack.top.value == 'works'
def test_pop():
    stack = Stack()
    stack.push('still here')
    stack.pop()
    assert stack.top == None
def test_stack_empty():
    test_stack = Stack()
    assert test_stack.top == None
def test_stack_is_empty():
    test_stack = create_stack(['a', 'b', 'c', 'd'])
    assert test_stack.is_empty() == False
    test_stack = Stack()
    assert test_stack.is_empty() == True
def test_stack_push():
    colors = Stack()
    colors.push('red')

    assert colors.top.data == 'red'
def test_stack_pop_return_value():
    colors = Stack()
    colors.push('orange')
    colors.push('red')

    assert colors.pop() == 'red'
def test_stack_push_two():
    colors = Stack()
    colors.push('red')
    colors.push('blue')

    assert colors.top.data == 'blue'
def test_stack_push_two_return_first():
    colors = Stack()
    colors.push('red')
    colors.push('blue')

    assert colors.top._next.data == 'red'
def test_push():
    test_stack = Stack()
    test_stack.push(1)
    test_stack.push(2)
    assert test_stack.top.value == 2
def test_empty_stack():
    test_stack = Stack()
    assert isinstance(test_stack, Stack)
def test_muliple_nodes():
    test_stack = Stack()
    test_stack.push(1)
    test_stack.push(2)
    test_stack.push(3)
    assert test_stack.length == 3
def test_empty_stack_peek():
    """Can successfully peek at an empty stack.
    """
    laundry = Stack()

    assert not laundry.top
def test_stack_pop_all_return():
    colors = Stack()
    colors.push('red')
    colors.pop()

    assert colors.pop() == 'Empty Stack'
def test_queue_is_empty():
    test_queue = create_queue(['a', 'b', 'c', 'd'])
    assert test_queue.is_empty() == False
    test_queue = Stack()
    assert test_queue.is_empty() == True
def test_stack_peek():
    testing_stack = Stack()
    testing_stack.push('hello')
    expected = 'hello'
    actual = testing_stack.peek()
    assert actual == expected
def create_stack(nodes):
    """helper function to create a stack"""
    test_stack = Stack()
    for el in nodes:
        test_stack.push(el)
    return test_stack
def test_stack_is_empty():
    testing_stack = Stack()
    expected = True
    actual = testing_stack.is_empty()
    assert actual == expected
 def __init__(self):
     # create Stack for internal data-struct
     self._data = Stack()
def test_stack_empty_pop():
    testing_stack = Stack()
    with pytest.raises(EmptyStackException):
        assert testing_stack.pop()
def test_push_multiple():
    stack = Stack()
    stack.push(1)
    stack.push(2)
    assert stack.top.value == 2 and stack.top.next.value == 1
def test_stack_push():
    testing_stack = Stack()
    testing_stack.push(2)
    expected = 2
    actual = testing_stack.peek()
    assert actual == expected
def test_stack():
    stack = Stack()
    assert stack.top == None
 def __init__(self):
     self.stack = Stack()
def test_pop_single():
    s = Stack()
    s.push("apple")
    actual = s.pop()
    expected = "apple"
    assert actual == expected
def test_stack_instantiation():
    """Can successfully instantiate an empty stack.
    """
    assert Stack()
def test_peek_empty():
    s = Stack()
    with pytest.raises(InvalidOperationError) as e:
        s.peek()

    assert str(e.value) == "Method not allowed on empty collection"
def test_stack_pop_all_return():
    hats = Stack()
    hats.push('gray')
    hats.pop()

    assert hats.pop() == 'Empty Stack'