Пример #1
0
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
Пример #6
0
def accum4(scope="session"):
    return Accumulator()
Пример #7
0
def accum3():
    yield Accumulator()
    print("DONE-ZO!")
Пример #8
0
def accum():
    return Accumulator()  # a fixture should always return a value
Пример #9
0
def accum():
    yield Accumulator()
    print("DONE...! wow")
Пример #10
0
def accum():
    return Accumulator()  # return/yield, yield turns it to a generator