def accum(): return Accumulator()
def test_accumulator_add_twice(): accum = Accumulator() accum.add() accum.add() assert accum.count == 2
def test_accumulator_cannot_set_count_directly(): accum = Accumulator() with pytest.raises(AttributeError, match=r"can't set attribute") as e: accum.count = 10
def test_accumulator_init(): accum = Accumulator() assert accum.count == 0
def test_accumulator_add_three(): accum = Accumulator() accum.add(3) assert accum.count == 3
def accum4(scope="session"): return Accumulator()
def accum3(): yield Accumulator() print("DONE-ZO!")
def accum(): return Accumulator() # a fixture should always return a value
def accum(): yield Accumulator() print("DONE...! wow")
def accum(): return Accumulator() # return/yield, yield turns it to a generator