示例#1
0
def test_linearroots():
    assert rt.linear_roots(5, 10) == -2
示例#2
0
def test_linear_zeroceoff():
    try:
        rt.linear_roots(a=0)
    except ValueError as err:
        assert (sys.exc_info()[0] == ValueError)
示例#3
0
def test_linearroots_types():
    with pytest.raises(TypeError):
        roots.linear_roots("ocean", 6.0)
示例#4
0
def test_linearroots_zerocoeff():
    with pytest.raises(ValueError):
        roots.linear_roots(a=0.0)
示例#5
0
def test_linearroots_zerocoeff():
    try:
        roots.linear_roots(a=0.0)
    except ValueError as err:
        assert(type(err) == ValueError)
示例#6
0
def test_linearoots_result():
    assert roots.linear_roots(2.0, -3.0) == 1.5
示例#7
0
def test_linearroots_types():
    try:
        roots.linear_roots("ocean", 6.0)
    except TypeError as err:
        assert(type(err) == TypeError)
示例#8
0
def test_linroots_types():
    with pytest.raises(TypeError):
        roots.linear_roots("o", 9.0)
示例#9
0
def test_linroots_result():
    assert roots.linear_roots(6.0, -12.0) == 2
示例#10
0
def test_linearroots_types():
    with pytest.raises(TypeError):
        roots.linear_roots("", "green", "hi")
示例#11
0
def test_linearroots_result():
    assert roots.linear_roots(1.0, 2.0) == -2.0