コード例 #1
0
def test_curry_quadratic():
    # tests if the quadratic currying function

    # create a specific quadratic function:
    quad234 = curry_quadratic(2, 3, 4)
    # quad234 is now a function that can take one argument, x
    # and will evaluate quadratic for those particular values of A,B,C

    # try it for a few values
    for x in range(5):
        assert quad234(x) == quadratic(x, 2, 3, 4)
コード例 #2
0
ファイル: test_trapz.py プロジェクト: iampei/IntroPython2015
def test_quadratic_2(x, y):
    """
    different coefficients
    """
    assert quadratic(x, A=-2, B=3, C=2) == y
コード例 #3
0
ファイル: test_trapz.py プロジェクト: iampei/IntroPython2015
def test_quadratic_1(x, y):
    """
    one set of coefficients
    """
    assert quadratic(x, A=1, B=1, C=1) == y
コード例 #4
0
ファイル: test_trapz.py プロジェクト: katdev/IntroPython2015
def test_quadratic_2(x, y):
    """
    different coefficients
    """
    assert quadratic(x, A=-2, B=3, C=2) == y
コード例 #5
0
ファイル: test_trapz.py プロジェクト: katdev/IntroPython2015
def test_quadratic_1(x, y):
    """
    one set of coefficients
    """
    assert quadratic(x, A=1, B=1, C=1) == y