def test_sine2():
# a sine curve from zero to 2pi -- should be 0.0
# need to set an absolute tolerance when comparing to zero
assert isclose(trapz(math.sin, 0, 2*math.pi), 0.0, abs_tol=1e-8)
# test the quadratic function itself
# this is pytest's way to test a bunch of input and output values
# it creates a separate test for each case.
评论列表
文章目录