
import StringIO

import bayeslite.bql as bql
import bayeslite.parse as parse

import test_smoke

def bql2sql(string):
    with test_smoke.t1() as bdb:
        phrases = parse.parse_bql_string(string)
        out = StringIO.StringIO()
        bql.compile_bql(bdb, phrases, out)
        return out.getvalue()

def test_select_trivial():
    assert bql2sql('select 0;') == 'select 0;'


import StringIO

import bayeslite.bql as bql
import bayeslite.parse as parse

import test_smoke

def bql2sql(string):
    with test_smoke.t1() as bdb:
        phrases = parse.parse_bql_string(string)
        out = StringIO.StringIO()
        bql.compile_bql(bdb, phrases, out)
        return out.getvalue()

def test_select_trivial():
    assert bql2sql('select 0;') == 'select 0;'
    assert bql2sql('select 0 as z;') == 'select 0 as "z";'
    assert bql2sql('select * from t;') == 'select * from "t";'
    assert bql2sql('select t.* from t;') == 'select "t".* from "t";'
    assert bql2sql('select c from t;') == 'select "c" from "t";'
    assert bql2sql('select c as d from t;') == 'select "c" as "d" from "t";'

Add some more trivial bql2sql tests.
Add some more trivial bql2sql tests.

  
  import StringIO
  
  import bayeslite.bql as bql
  import bayeslite.parse as parse
  
  import test_smoke
  
  def bql2sql(string):
      with test_smoke.t1() as bdb:
          phrases = parse.parse_bql_string(string)
          out = StringIO.StringIO()
          bql.compile_bql(bdb, phrases, out)
          return out.getvalue()
  
  def test_select_trivial():
      assert bql2sql('select 0;') == 'select 0;'
+     assert bql2sql('select 0 as z;') == 'select 0 as "z";'
+     assert bql2sql('select * from t;') == 'select * from "t";'
+     assert bql2sql('select t.* from t;') == 'select "t".* from "t";'
+     assert bql2sql('select c from t;') == 'select "c" from "t";'
+     assert bql2sql('select c as d from t;') == 'select "c" as "d" from "t";'
  
Add some more trivial bql2sql tests.
## Code Before:

import StringIO

import bayeslite.bql as bql
import bayeslite.parse as parse

import test_smoke

def bql2sql(string):
    with test_smoke.t1() as bdb:
        phrases = parse.parse_bql_string(string)
        out = StringIO.StringIO()
        bql.compile_bql(bdb, phrases, out)
        return out.getvalue()

def test_select_trivial():
    assert bql2sql('select 0;') == 'select 0;'

## Instruction:
Add some more trivial bql2sql tests.
## Code After:

import StringIO

import bayeslite.bql as bql
import bayeslite.parse as parse

import test_smoke

def bql2sql(string):
    with test_smoke.t1() as bdb:
        phrases = parse.parse_bql_string(string)
        out = StringIO.StringIO()
        bql.compile_bql(bdb, phrases, out)
        return out.getvalue()

def test_select_trivial():
    assert bql2sql('select 0;') == 'select 0;'
    assert bql2sql('select 0 as z;') == 'select 0 as "z";'
    assert bql2sql('select * from t;') == 'select * from "t";'
    assert bql2sql('select t.* from t;') == 'select "t".* from "t";'
    assert bql2sql('select c from t;') == 'select "c" from "t";'
    assert bql2sql('select c as d from t;') == 'select "c" as "d" from "t";'
