Пример #1
0
def test_validate_float1():
    good = [0.5, 0, '0.123', 2, inf, nan]
    for value in good:
        val1 = validate_float(value)
        val2 = float(value)
        if not val1 is val2:
            assert_almost_equal(val1, val2)
Пример #2
0
def test_validate_float1():
    good = [0.5, 0, '0.123', 2, inf, nan]
    for value in good:
        val1 = validate_float(value)
        val2 = float(value)
        if not val1 is val2:
            assert val1 == pytest.approx(val2)
Пример #3
0
def test_validate_float1():
    good = [0.5, 0, '0.123', 2, inf, nan]
    for value in good:
        val1 = validate_float(value)
        val2 = float(value)
        if not val1 is val2:
            assert_almost_equal(val1, val2)
Пример #4
0
def test_validate_float1():
    good = [0.5, 0, '0.123', 2, inf, nan]
    for value in good:
        val1 = validate_float(value)
        val2 = float(value)
        if not val1 is val2:
            assert val1 == pytest.approx(val2)
Пример #5
0
def test_validate_float2():
    bad = ['pants', float, []]
    for value in bad:
        with pytest.raises(ValueError):
            validate_float(value)
Пример #6
0
def test_validate_float2():
    bad = ['pants', float, []]
    for value in bad:
        with pytest.raises(ValueError):
            validate_float(value)