示例#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)
示例#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_([])
示例#3
0
def test_check_decimals_other_str():
    with pytest.raises(ValueError):
        ch._check_decimals_('infe')
    with pytest.raises(ValueError):
        ch._check_decimals_('Infer')
示例#4
0
def test_check_decimals_infer():
    assert ch._check_decimals_('infer') == 'infer'
示例#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