def test_parse_select_core(): ast = query_parser.parse_select(LoadOp('bogus'), 'x, x as x2, 49929') assert_is_instance(ast, ProjectionOp) assert_is_instance(ast.exprs[0], Var) eq_(ast.exprs[0].path, 'x') assert_is_instance(ast.exprs[1], RenameOp) eq_(ast.exprs[1].name, 'x2') assert_is_instance(ast.exprs[1].expr, Var) eq_(ast.exprs[1].expr.path, 'x') assert_is_instance(ast.exprs[2], NumberConst) eq_(ast.exprs[2].const, 49929)
def test_parse_select_all_frm_table(): ast = query_parser.parse_select(LoadOp('table'), 'table.*, x') eq_(ast, ProjectionOp(LoadOp('table'), SelectAllExpr('table'), Var('x')))
def test_parse_select_all(): ast = query_parser.parse_select(LoadOp('bogus'), '*') eq_(ast, LoadOp('bogus'))