Sorry if this is an FAQ; I googled and came up empty:<br><br>Is this the appropriate way to test for floating point return values from a function (with nose)?<br><br># begin code<br>FLTTOL = 0.00001<br><br>def addtwonumbers(num1, num2):<br>
return num1 + num2<br><br>def test_addtwonumbers():<br> assert addtwonumbers(4, 6) == 10<br> assert addtwonumbers(8, 32) == 40<br> assert abs(addtwonumbers(4.3, -2.1) - 2.2) < FLTTOL<br> # end code<br><br>
Thanks a ton.<br><br>