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)
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
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)
def test_ceil_parse():
    e = Function.parse(None, 'CEIL(1)', 0)
    assert isinstance(e, rounding.CeilFunction)
def test_floor_parse():
    e = Function.parse(None, 'FLOOR(1)', 0)
    assert isinstance(e, rounding.FloorFunction)
def test_round_parse():
    e = Function.parse(None, 'ROUND(1)', 0)
    assert isinstance(e, rounding.RoundFunction)
Exemple #7
0
def test_shl_parse():
    e = Function.parse(None, 'SHL(1, 2)', 0)
    assert isinstance(e, bitwise.SHLFunction)
Exemple #8
0
def test_bitxor_parse():
    e = Function.parse(None, 'BITXOR(1, 2)', 0)
    assert isinstance(e, bitwise.BitXOrFunction)
Exemple #9
0
def test_bitnot_parse():
    e = Function.parse(None, 'BITNOT(1)', 0)
    assert isinstance(e, bitwise.BitNotFunction)
Exemple #10
0
def test_bom_parse():
    e = Function.parse(None, 'BOM()', 0)
    assert isinstance(e, date.BOMFunction)
Exemple #11
0
def test_year_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'YEAR(1, 2)', 0)
Exemple #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)
Exemple #13
0
def test_date_parse():
    e = Function.parse(None, 'DATE(2019, 3, 14, 1, 2, 3)', 0)
    assert isinstance(e, date.DateFunction)
Exemple #14
0
def test_year_parse():
    e = Function.parse(None, 'YEAR()', 0)
    assert isinstance(e, date.YearFunction)
Exemple #15
0
def test_millisecond_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'MILLISECOND(1)', 0)
Exemple #16
0
def test_dow_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'DOW(1, 2)', 0)
Exemple #17
0
def test_bitand_parse():
    e = Function.parse(None, 'BITAND(1, 2)', 0)
    assert isinstance(e, bitwise.BitAndFunction)
Exemple #18
0
def test_month_parse():
    e = Function.parse(None, 'MONTH()', 0)
    assert isinstance(e, date.MonthFunction)
Exemple #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)
Exemple #20
0
def test_month_num_args():
    with pytest.raises(InvalidNumberOfArguments):
        Function.parse(None, 'MONTH(1, 2)', 0)
Exemple #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)
Exemple #22
0
def test_hmsinterval_parse():
    e = Function.parse(None, 'HMSINTERVAL(1, 1, 1, 2, 2, 2)', 0)
    assert isinstance(e, date.HMSIntervalFunction)
Exemple #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)
Exemple #24
0
def test_day_parse():
    e = Function.parse(None, 'DAY()', 0)
    assert isinstance(e, date.DayFunction)
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)
Exemple #26
0
def test_mdinterval_parse():
    e = Function.parse(None, 'MDINTERVAL(1, 1, 2, 2)', 0)
    assert isinstance(e, date.MDIntervalFunction)
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)
Exemple #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)
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)
Exemple #30
0
def test_dow_parse():
    e = Function.parse(None, 'DOW()', 0)
    assert isinstance(e, date.DOWFunction)