[Checkins] SVN: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/
typo fix, added beginnings of tests for interface realization,
which brought up some bugs
Adam Groszer
agroszer at gmail.com
Thu Jul 10 03:55:07 EDT 2008
Log message for revision 88156:
typo fix, added beginnings of tests for interface realization, which brought up some bugs
Changed:
U Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/interfaces.py
U Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/interfaces.py
U Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/queryobject.py
A Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/queryobject.txt
A Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/tests.py
U Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/algebra.py
A Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/algebra.txt
U Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/tests.py
-=-
Modified: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/interfaces.py
===================================================================
--- Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/interfaces.py 2008-07-10 07:20:40 UTC (rev 88155)
+++ Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/interfaces.py 2008-07-10 07:55:05 UTC (rev 88156)
@@ -67,11 +67,6 @@
# def rewrite(self):
# """Rewrites query object in to algebra object"""
-class IObjectQueyChild(Interface):
- """Objects providing this interface represents a child in the query object tree
- """
- children = Attribute('Children collection')
-
class IObjectQuery(Interface):
"""Objects providing this interface represent the OCQL query
as python objects
@@ -89,14 +84,16 @@
"""
tree = Attribute('holds the root of the algebra object tree')
- def walk(self):
+ def walk():
"""Iterate the Algebra object tree"""
class IAlgebraObject(Interface):
"""Objects providing this interface represent the
rewritten ObjectQuery to Algebra objects
"""
- def walk(self):
+ children = Attribute('Children collection')
+
+ def walk():
"""Iterate the Algebra object tree"""
class IOptimizedAlgebraObject(Interface):
Modified: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/interfaces.py
===================================================================
--- Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/interfaces.py 2008-07-10 07:20:40 UTC (rev 88155)
+++ Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/interfaces.py 2008-07-10 07:55:05 UTC (rev 88156)
@@ -3,9 +3,14 @@
from zope.interface import Attribute, Interface
from zope.schema import TextLine
-from ocql.interfaces import IObjectQuery, IObjectQueyChild
+from ocql.interfaces import IObjectQuery
-class ITerm(IObjectQueyChild):
+class IObjectQueryChild(Interface):
+ """Objects providing this interface represents a child in the query object tree
+ """
+ children = Attribute('Children collection')
+
+class ITerm(IObjectQueryChild):
"""Objects providing this interface represent the
Term Query object
"""
@@ -21,7 +26,7 @@
"""Objects providing this interface represent the
hasClassWith Query object
"""
- expression = Attribute('expression')
+ expression = Attribute('expression')
klass = Attribute('collection type')
conditional = Attribute('conditional')
@@ -168,7 +173,7 @@
"""
expr = Attribute('expression')
-class IQuanted(IObjectQueyChild):
+class IQuanted(IObjectQueryChild):
"""Objects providing this interface represent the
Quanted Query object
"""
Modified: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/queryobject.py
===================================================================
--- Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/queryobject.py 2008-07-10 07:20:40 UTC (rev 88155)
+++ Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/queryobject.py 2008-07-10 07:55:05 UTC (rev 88156)
@@ -6,8 +6,6 @@
"""
#TODOS:
-#write Interfaces for all classes
-
#move self.rewrite to ocql.rewriter into adapters
#add self.__repr__ to ALL, see Query class
@@ -17,7 +15,8 @@
from zope.interface import implements
from zope.location import locate, Location
-from ocql.interfaces import IObjectQuery, IObjectQueryHead, IObjectQueyChild
+from ocql.interfaces import IObjectQuery
+from ocql.interfaces import IObjectQueryHead
from ocql.queryobject.interfaces import *
class Head(Location):
@@ -26,13 +25,13 @@
self.name = 'head'
self.tree = tree
locate(tree, self, 'tree')
-
-
+
+
def rewrite(self):
return self.tree
class Child(Location):
- implements(IObjectQueyChild)
+ implements(IObjectQueryChild)
children = []
class QueryObject(Child):
@@ -98,7 +97,7 @@
class hasClassWith(Expression):
#NotImplementedError
implements(IhasClassWith)
-
+
expression = None
klass = None
conditional = None
@@ -255,7 +254,7 @@
self.symbols.dellevel()
return rv
-class In(Term):
+class In(Term):
implements(IIn)
def __repr__(self):
return "%s(%s, %s)" % (
@@ -457,12 +456,12 @@
self.symbols = symbols
self.expr = expr
self.children.append(expr)
-
+
def __repr__(self):
return "(%s)" % (
self.__class__.__name__
)
-
+
def rewrite(self, algebra, expression, quanter, operator):
raise NotImplementedError()
Added: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/queryobject.txt
===================================================================
--- Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/queryobject.txt (rev 0)
+++ Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/queryobject.txt 2008-07-10 07:55:05 UTC (rev 88156)
@@ -0,0 +1,18 @@
+
+Checks here make sure that Interfaces are properly implemented
+
+#TODO: extend for all Interfaces and classes
+
+ >>> from ocql.interfaces import IObjectQuery
+ >>> from ocql.interfaces import IObjectQueryHead
+ >>> from ocql.queryobject.interfaces import *
+
+ >>> from ocql.queryobject.queryobject import *
+
+ >>> from zope.interface.verify import verifyClass, verifyObject
+
+ >>> verifyClass(IObjectQueryHead, Head)
+ True
+
+ >>> verifyClass(IObjectQuery, QueryObject)
+ True
Property changes on: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/queryobject.txt
___________________________________________________________________
Name: svn:keywords
+ Date Author Id Revision
Name: svn:eol-style
+ native
Added: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/tests.py
===================================================================
--- Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/tests.py (rev 0)
+++ Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/tests.py 2008-07-10 07:55:05 UTC (rev 88156)
@@ -0,0 +1,14 @@
+import unittest
+import doctest
+from zope.testing.doctestunit import DocTestSuite,DocFileSuite
+
+def test_suite():
+ flags = doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
+ return unittest.TestSuite((
+ DocFileSuite('queryobject.txt',
+ optionflags=flags),
+ ))
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Property changes on: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/queryobject/tests.py
___________________________________________________________________
Name: svn:keywords
+ Date Author Id Revision
Name: svn:eol-style
+ native
Modified: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/algebra.py
===================================================================
--- Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/algebra.py 2008-07-10 07:20:40 UTC (rev 88155)
+++ Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/algebra.py 2008-07-10 07:55:05 UTC (rev 88156)
@@ -25,6 +25,9 @@
self.tree = tree
locate(tree, self, 'tree')
+ def walk(self):
+ yield self.tree
+
def __repr__(self):
return ('%s') % (self.tree)
Added: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/algebra.txt
===================================================================
--- Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/algebra.txt (rev 0)
+++ Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/algebra.txt 2008-07-10 07:55:05 UTC (rev 88156)
@@ -0,0 +1,18 @@
+
+Checks here make sure that Interfaces are properly implemented
+
+#TODO: extend for all Interfaces and classes
+
+ >>> from ocql.interfaces import IAlgebraObject
+ >>> from ocql.interfaces import IAlgebraObjectHead
+ >>> from ocql.rewriter.interfaces import *
+
+ >>> from ocql.rewriter.algebra import *
+
+ >>> from zope.interface.verify import verifyClass, verifyObject
+
+ >>> verifyClass(IAlgebraObjectHead, Head)
+ True
+
+ >>> verifyClass(IAlgebraObject, BaseAlgebra)
+ True
Property changes on: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/algebra.txt
___________________________________________________________________
Name: svn:keywords
+ Date Author Id Revision
Name: svn:eol-style
+ native
Modified: Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/tests.py
===================================================================
--- Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/tests.py 2008-07-10 07:20:40 UTC (rev 88155)
+++ Sandbox/adamg/ocql/branches/qo-compiler/src/ocql/rewriter/tests.py 2008-07-10 07:55:05 UTC (rev 88156)
@@ -7,6 +7,8 @@
return unittest.TestSuite((
DocFileSuite('rewriter.txt',
optionflags=flags),
+ DocFileSuite('algebra.txt',
+ optionflags=flags),
DocTestSuite('ocql.rewriter.algebra')
))
More information about the Checkins
mailing list