Example #1
0
def test_integrate_trapz_failure():
    with pytest.raises(Exception):
        integrate_trapz("Some", "Values")
Example #2
0
def test_integrate_trapz_1():
    xs, ys = np.linspace(0, 10, 11), np.linspace(0, 10, 11)
    assert integrate_trapz(xs, ys) == 50
Example #3
0
def test_integrate_trapz_1():
    xs, ys = np.linspace(0, 10, 10), np.zeros(10)
    assert integrate_trapz(xs, ys) == 0
Example #4
0
def test_integrate_trapz_failure():
    with pytest.raises(Exception):
        integrate_trapz("Some", "Values")


# some arbitrary change to force a commit push to test travis
Example #5
0
def test_integrate_trapz_2():
    xs, ys = np.linspace(0, 10, 10), np.linspace(0, 10, 10)
    assert integrate_trapz(xs, ys) != 0
Example #6
0
def test_integrate_trapz_tri():
    width = 10
    slope = 2
    xs = np.linspace(0, width, 10)
    ys = np.array([slope * x for x in xs])
    assert integrate_trapz(xs, ys) == 0.5 * width * (slope * width)
Example #7
0
def test_integrate_trapz_2():
    width = 10
    height = 1
    xs, ys = np.linspace(0, width, 10), np.zeros(10) + height
    assert integrate_trapz(xs, ys) == width * height