def test_p1_v1(a): s = Stack() for x in a: s.push(x) while s.len() > 0: s.pop() assert s.pop() == None assert s.len() == 0
def test_p9_len_is_side_effect_free(values): stack = Stack() for v in values: stack.push(v) stack.len() for v in reversed(values): assert stack.pop() == v assert stack.pop() == None
def test_p1_v2(a): s = Stack() for x in a: s.push(x) for x in a: s.pop() assert s.pop() == None assert s.len() == 0
def test_p10_push_does_not_return_value(values): stack = Stack() for v in values: assert stack.push(v) == None
def test_p4_pushing_None_raises_ValueError(v): stack = Stack() if v == None: with pytest.raises(ValueError): s.push(v)
def test_p1_lifo(values): stack = Stack() for v in values: stack.push(v) for v in reversed(values): assert stack.pop() == v
def populate_stack(values): stack=Stack() for v in values: stack.push(v) return stack
def test_p4_pushing_None_raises_ValueError(): s = Stack() with pytest.raises(ValueError): s.push(None)