Commits

Olemis Lang committed 20fe964 Merge

TracGViz : Fixing in default branch the issue with single LABEL expression

Comments (0)

Files changed (2)

trac-dev/gviz/tracgviz/gvizql.py

   def __init__(self, seq):
     r"""Initialize this clause with a sequence of formatting expressions
     """
-    self.labels = list(seq)
+    if not isinstance(seq, Sequence):
+      seq = Sequence([seq])
+    self.labels = seq
 
   def transform(self, schema, data):
     r"""(Add | modify) the schema in order to (include | update) 

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

 
       """,
   'Parsing LABEL' : r"""
+      >>> parse("select name label name 'Employee Id' ", 'labels', 'cols')
+      ... 
+      *****
+      * Tokens
+      *****
+      Token.Keyword.Reserved select
+      Token.Name.Variable name
+      Token.Keyword.Reserved label
+      Token.Name.Variable name
+      Token.Literal.String.Single 'Employee Id'
+      *****
+      * Parsing
+      *****
+      [(u'name', 'Employee Id')]
+      [u'name']
+      *****
+      * Result
+      *****
+      = Columns =
+      name string Employee Id
+      = Row =
+         name = John
+      = Row =
+         name = Dave
+      = Row =
+         name = Sally
+      = Row =
+         name = Ben
+      = Row =
+         name = Dana
+      = Row =
+         name = Mike
+
+
       >>> parse("select name label    dept 'Department' , " \
       ...           "name 'Employee Id' ", 'labels', 'cols')
       ...