def test_is_empty(self): stack = Stack() assert stack.is_empty() is True stack.push(1) assert stack.is_empty() is False stack.pop() assert stack.is_empty() is True
def test_pop_all(self): tests = [1, '0', Stack, lambda x: x, {}, [], None] stack = Stack(tests) assert len(stack) == len(tests) stack.pop_all() assert stack.is_empty() is True
def test_pop_items_with_initial_stack(self): tests = [1, '0', Stack, lambda x: x, {}, [], None] stack = Stack(tests) assert len(stack) == len(tests) for _ in tests: stack.pop() assert stack.is_empty() is True
def test_is_empty_returns_false_on_stack_with_elements(): stack = Stack() stack.push(42) assert not stack.is_empty()
def test_is_empty_returns_true_on_empty_stack(): stack = Stack() assert stack.is_empty()