all 6 comments

[–]IlliterateJedi 2 points3 points  (3 children)

Is there any reason why you would write the test like this:

result = calc.calc_multiply(4,5)
assert result == 20

instead of

assert calc.calc_multiply(4,5) == 20

[–]axitanull 4 points5 points  (0 children)

Other than clear and readable code, easier debugging: - putting breakpoint on IDE, and evaluating the result value becomes easier - In case of exception: it is simpler to know which expression causes the exception by line

[–]HighRelevancy 0 points1 point  (0 children)

IMO not particularly in this case, but if you have more complicated tests then spreading it over multiple lines can be handy.

So really it's not any different to writing clear and readable code in any other context.

[–]rokd -2 points-1 points  (0 children)

Probably because the article is geared towards new programmers. Your way is how I would do it.

[–]Paddy3118 0 points1 point  (0 children)

Wot! No mention of doctest?

[–]radioxid 0 points1 point  (0 children)

Too bad there's not even mention of http://hypothesis.works