Beispiel #1
0
def test_as_percent_numeric_value():

    with pytest.raises(TypeError) as context:
        ionic.as_percent(u'0.50')

    assert 'Numeric type required' in str(context.value)
Beispiel #2
0
def test_as_percent():

    assert ionic.as_percent(0.425) == '42.50%'
    assert ionic.as_percent(0.218, precision='0.1') == '21.8%'
    assert ionic.as_percent(0.02) == '2.00%'
    assert ionic.as_percent(0.91, precision='0.0') == '91%'