Exemplo n.º 1
0
def test_check_decimals_negative_int():
    with pytest.raises(ValueError) as context:
        ch._check_decimals_(-2)
    assert str(context.value
               ) == "Parameter -decimals- must be an int >= 0, or 'infer'."
    with pytest.raises(ValueError):
        ch._check_decimals_(-5)
Exemplo n.º 2
0
def test_check_decimals_other_type():
    with pytest.raises(ValueError):
        assert ch._check_decimals_(-2)
    with pytest.raises(ValueError) as context:
        assert ch._check_decimals_(-2)
    assert str(context.value
               ) == "Parameter -decimals- must be an int >= 0, or 'infer'."
    with pytest.raises(ValueError):
        assert ch._check_decimals_(None)
    with pytest.raises(ValueError) as context:
        assert ch._check_decimals_([])
Exemplo n.º 3
0
def test_check_decimals_other_str():
    with pytest.raises(ValueError):
        ch._check_decimals_('infe')
    with pytest.raises(ValueError):
        ch._check_decimals_('Infer')
Exemplo n.º 4
0
def test_check_decimals_infer():
    assert ch._check_decimals_('infer') == 'infer'
Exemplo n.º 5
0
def test_check_decimals_positive_int():
    assert ch._check_decimals_(2) == 2
    assert ch._check_decimals_(0) == 0
    assert ch._check_decimals_(8) == 8