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')
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')