示例#1
0
def test_mul():
    result = m.mul(558, 221)
    assert result == 558 * 221
示例#2
0
def test_sub_zero():
    result = m.sub(558, 0)
    assert result == 558 - 0
示例#3
0
def test_sub_minus():
    result = m.sub(558, 1111)
    assert result == 558 - 1111
示例#4
0
def test_div_zero():
    with pytest.raises(ZeroDivisionError):
        result = m.div(558, 0)
示例#5
0
def test_fact_zero() :
    result = m.fact(0)
    assert result == 1
示例#6
0
def test_mul_minus():
    result = m.mul(558, -55)
    assert result == 558 * -55
示例#7
0
def test_div_float():
    result = m.div(558, 2.)
    assert result == 558 / 2.
示例#8
0
def test_root_zero():
    result = m.n_root(2, 0)
    assert result == 0
示例#9
0
def test_root():
    result = m.n_root(64, 2)
    assert result == math.sqrt(64)
示例#10
0
def test_root_2():
    result = m.n_root(555, 2)
    assert result == round(math.sqrt(555), 13)
示例#11
0
def test_root_neg():
    with pytest.raises(ValueError):
        result = m.n_root(-55, 2)
示例#12
0
def test_fact() :
    result = m.fact(3)
    assert result == 6
示例#13
0
def test_fact_float() :
    with pytest.raises(ValueError) :
        result = m.fact(8.99)
示例#14
0
def test_fact_zero_float() :
    with pytest.raises(ValueError) :
        result = m.fact(0.25)
示例#15
0
def test_mul_float():
    result = m.mul(558, 221.555)
    assert result == 558 * 221.555
示例#16
0
def test_add_float():
    result = m.add(558, 221.)
    assert result == 558 + 221.
示例#17
0
def test_mul_zero():
    result = m.mul(558, 0)
    assert result == 558 * 0
示例#18
0
def test_add_float_2():
    result = m.add(558.55, 221.9)
    assert result == 558.55 + 221.9
示例#19
0
def test_div():
    result = m.div(558, 221)
    assert result == 558 / 221
示例#20
0
def test_sub():
    result = m.sub(558, 221)
    assert result == 558 - 221
示例#21
0
def test_div_float_2():
    result = m.div(558.444, 221.1)
    assert result == 558.444 / 221.1
示例#22
0
def test_sub_float():
    result = m.sub(558.88, 221)
    assert result == 558.88 - 221
示例#23
0
def test_add():
    result = m.add(558, 221)
    assert result == 558 + 221
示例#24
0
def test_fact_neg() :
    with pytest.raises(ValueError) :
        result = m.fact(-3)