Commits

Olemis Lang committed 597a6c5

GViz QL : Test for OPTIONS clause ... [ok]

gvizql.py Total tests : 62 , Failures : 0 , Errors : 3

  • Participants
  • Parent commits 233753f
  • Branches gviz_ql

Comments (0)

Files changed (2)

File trac-dev/gviz/tracgviz/gvizql.py

   def __init__(self, seq):
     r"""Initialize this clause with a list of option names.
     """
-    self.options = seq
+    if not isinstance(seq, Sequence):
+      get_col_schema = lambda _colnm: (_colnm, None)
+      seq = seq['schema'](get_col_schema)[0]
+      seq = Sequence([seq])
+    self.opts = seq
 
   def transform(self, schema, data):
     r"""Condition the result set according to options.
     return labels
 
   def handle_column(self, colnm):
-    return colnm[1]
+    return colnm[1]['schema'](lambda _colnm: (_colnm, None))[0]
 
   def handle_colseq(self, colseq, _, colnm):
     colseq = colseq[1]
     colnm = colnm[1]
+    get_col_schema = lambda _colnm: (_colnm, None)
     if isinstance(colseq, self.Sequence):
+      colnm = colnm['schema'](get_col_schema)[0]
       colseq.append(colnm)
     else:
+      colseq = colseq['schema'](get_col_schema)[0]
+      colnm = colnm['schema'](get_col_schema)[0]
       colseq = self.Sequence([colseq, colnm])
     return colseq
 

File trac-dev/gviz/tracgviz/testing/test_gvizql.py

       *****
       * Parsing
       *****
-      NotSupported  :(
+      [u'no_format']
+      None
+      *****
+      * Result
+      *****
+      GVizUnsupportedQueryOp  :  Unable to evaluate OPTIONS clause. Either the whole clause or an specific feature is not supported yet.
+
 
       >>> parse("select dept , salary options no_values", 'opts', 'cols')
       *****
       *****
       * Parsing
       *****
-      NotSupported  :(
+      [u'no_values']
+      [u'dept', u'salary']
+      *****
+      * Result
+      *****
+      GVizUnsupportedQueryOp  :  Unable to evaluate OPTIONS clause. Either the whole clause or an specific feature is not supported yet.
+
 
       >>> parse("select `email address`, name, `date` options no_values", \
       ...           'opts', 'cols')
       *****
       * Parsing
       *****
-      NotSupported  :(
+      [u'no_values']
+      [u'email address', u'name', u'date']
+      *****
+      * Result
+      *****
+      GVizRuntimeError  :  Unknown column email address.
+
       """,
     'Parsing (failures)' : r"""
       >>> parse("  select ", 'cols', fail=True)