Exemplo n.º 1
0
def test_history_num_args(mock_persist_driver):
    mock_persist_driver.enable_history_support()

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'HISTORY(@some_id, 1)', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'HISTORY(@some_id, 1, 2, 3)', 0)
Exemplo n.º 2
0
def test_history_arg_type(mock_persist_driver):
    mock_persist_driver.enable_history_support()

    with pytest.raises(InvalidArgumentKind) as exc_info:
        Function.parse(None, 'HISTORY(1, 2, 3)', 0)

    assert exc_info.value.name == 'HISTORY'
    assert exc_info.value.num == 1
    assert exc_info.value.pos == 9
Exemplo n.º 3
0
def test_lutli_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'LUTLI(1)', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'LUTLI(1, 2)', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'LUTLI(1, 2, 3, 4)', 0)
Exemplo n.º 4
0
def test_ceil_parse():
    e = Function.parse(None, 'CEIL(1)', 0)
    assert isinstance(e, rounding.CeilFunction)
Exemplo n.º 5
0
def test_floor_parse():
    e = Function.parse(None, 'FLOOR(1)', 0)
    assert isinstance(e, rounding.FloorFunction)
Exemplo n.º 6
0
def test_round_parse():
    e = Function.parse(None, 'ROUND(1)', 0)
    assert isinstance(e, rounding.RoundFunction)
Exemplo n.º 7
0
def test_shl_parse():
    e = Function.parse(None, 'SHL(1, 2)', 0)
    assert isinstance(e, bitwise.SHLFunction)
Exemplo n.º 8
0
def test_bitxor_parse():
    e = Function.parse(None, 'BITXOR(1, 2)', 0)
    assert isinstance(e, bitwise.BitXOrFunction)
Exemplo n.º 9
0
def test_bitnot_parse():
    e = Function.parse(None, 'BITNOT(1)', 0)
    assert isinstance(e, bitwise.BitNotFunction)
Exemplo n.º 10
0
def test_bom_parse():
    e = Function.parse(None, 'BOM()', 0)
    assert isinstance(e, date.BOMFunction)
Exemplo n.º 11
0
def test_year_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'YEAR(1, 2)', 0)
Exemplo n.º 12
0
def test_date_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'DATE(2019, 3, 14, 1, 2)', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'DATE(2019, 3, 14, 1, 2, 3, 4)', 0)
Exemplo n.º 13
0
def test_date_parse():
    e = Function.parse(None, 'DATE(2019, 3, 14, 1, 2, 3)', 0)
    assert isinstance(e, date.DateFunction)
Exemplo n.º 14
0
def test_year_parse():
    e = Function.parse(None, 'YEAR()', 0)
    assert isinstance(e, date.YearFunction)
Exemplo n.º 15
0
def test_millisecond_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'MILLISECOND(1)', 0)
Exemplo n.º 16
0
def test_dow_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'DOW(1, 2)', 0)
Exemplo n.º 17
0
def test_bitand_parse():
    e = Function.parse(None, 'BITAND(1, 2)', 0)
    assert isinstance(e, bitwise.BitAndFunction)
Exemplo n.º 18
0
def test_month_parse():
    e = Function.parse(None, 'MONTH()', 0)
    assert isinstance(e, date.MonthFunction)
Exemplo n.º 19
0
def test_bitnot_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'BITNOT()', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'BITNOT(1, 2)', 0)
Exemplo n.º 20
0
def test_month_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'MONTH(1, 2)', 0)
Exemplo n.º 21
0
def test_bitxor_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'BITXOR(1)', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'BITXOR(1, 2, 3)', 0)
Exemplo n.º 22
0
def test_hmsinterval_parse():
    e = Function.parse(None, 'HMSINTERVAL(1, 1, 1, 2, 2, 2)', 0)
    assert isinstance(e, date.HMSIntervalFunction)
Exemplo n.º 23
0
def test_shl_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'SHL(1)', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'SHL(1, 2, 3)', 0)
Exemplo n.º 24
0
def test_day_parse():
    e = Function.parse(None, 'DAY()', 0)
    assert isinstance(e, date.DayFunction)
Exemplo n.º 25
0
def test_round_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'ROUND()', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'ROUND(1, 2, 3)', 0)
Exemplo n.º 26
0
def test_mdinterval_parse():
    e = Function.parse(None, 'MDINTERVAL(1, 1, 2, 2)', 0)
    assert isinstance(e, date.MDIntervalFunction)
Exemplo n.º 27
0
def test_floor_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'FLOOR()', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'FLOOR(1, 2)', 0)
Exemplo n.º 28
0
def test_mdinterval_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'MDINTERVAL(1, 2, 3)', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'MDINTERVAL(1, 2, 3, 4, 5)', 0)
Exemplo n.º 29
0
def test_ceil_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'CEIL()', 0)

    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'CEIL(1, 2)', 0)
Exemplo n.º 30
0
def test_dow_parse():
    e = Function.parse(None, 'DOW()', 0)
    assert isinstance(e, date.DOWFunction)