Example #1
0
def test__float_01():
    assert_equal(_float_01(0), 0)
    assert_equal(_float_01(1), 1)
    assert_equal(_float_01('0'), 0)
    assert_equal(_float_01('0.2'), 0.2)
    assert_raises(ValueError, _float_01, 1.1)
    assert_raises(ValueError, _float_01, -0.1)
    assert_raises(ValueError, _float_01, 2)
    assert_raises(ValueError, _float_01, -1)
    assert_raises(ValueError, _float_01, 'foo')
Example #2
0
def test__float_01():
    assert_equal(_float_01(0), 0)
    assert_equal(_float_01(1), 1)
    assert_equal(_float_01('0'), 0)
    assert_equal(_float_01('0.2'), 0.2)
    assert_raises(ValueError, _float_01, 1.1)
    assert_raises(ValueError, _float_01, -0.1)
    assert_raises(ValueError, _float_01, 2)
    assert_raises(ValueError, _float_01, -1)
    assert_raises(ValueError, _float_01, 'foo')
Example #3
0
def test__float_01():
    assert _float_01(0) == 0
    assert _float_01(1) == 1
    assert _float_01('0') == 0
    assert _float_01('0.2') == 0.2
    with pytest.raises(ValueError):
        _float_01(1.1)
    with pytest.raises(ValueError):
        _float_01(-0.1)
    with pytest.raises(ValueError):
        _float_01(2)
    with pytest.raises(ValueError):
        _float_01(-1)
    with pytest.raises(ValueError):
        _float_01('foo')