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