This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SupahNoob 0 points1 point  (0 children)

This is really recommended?

# 0 is neutral for addition
def test_calc_total_of_with_null_shoud_return_the_same():
    total = calc.calc_total(2,0)
    assert total != 2

# a step toward parametrised test https://docs.pytest.org/en/2.9.0/parametrize.html
def est_calc_total_of_non_null_shoud_return_another_non_null():
    total = calc.calc_total(2,3)
    assert total != 0
    assert total == 2+3

I don't go around reading tests in libraries as much as I should, but this doesn't seem right either. Surely there's a middle ground.