예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
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')))
예제 #4
0
def test_parse_select_all():
  ast = query_parser.parse_select(LoadOp('bogus'), '*')
  eq_(ast, LoadOp('bogus'))
예제 #5
0
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')))
예제 #6
0
def test_parse_select_all():
    ast = query_parser.parse_select(LoadOp('bogus'), '*')
    eq_(ast, LoadOp('bogus'))