Пример #1
0
def test_print_empty_stack(capsys):
    stack = Stack()
    stack.print()

    expected = "[]\n"
    output = capsys.readouterr().out
    assert output == expected
Пример #2
0
def test_print_stack_with_elements(capsys):
    stack = Stack([1, 2, 3, 4, 5])
    stack.print()

    expected = "[1, 2, 3, 4, 5]\n"
    output = capsys.readouterr().out
    assert output == expected