Update of /cvsroot/modeling/ProjectModeling/Modeling/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv32057/tests
Modified Files:
test_EditingContext_Global.py test_Qualifier.py
Log Message:
Added operator 'in' and 'not in' for fetch qualifiers. Operators 'AND', 'OR'
and 'NOT' can now be written with lower-case characters.
Index: test_EditingContext_Global.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** test_EditingContext_Global.py 7 Jul 2003 14:57:14 -0000 1.26
--- test_EditingContext_Global.py 10 Jul 2003 11:57:55 -0000 1.27
***************
*** 708,712 ****
self.failUnless('Dard' in objects_names)
-
def test_12_fetchingDoesNotUpdateSnapshot(self):
"[EditingContext] Fetching should not update the Database's snapshot"
--- 708,711 ----
***************
*** 913,916 ****
--- 912,934 ----
self.failIf(objs)
+ def test_19_in_not_in_operators_in_qualifiers(self):
+ "[EditingContext] IN/NOT IN operators in qualifiers"
+ ec=EditingContext()
+ objects=ec.fetch('Writer', 'age in [24, 82]')
+ objects_names=[o.getLastName() for o in objects]
+ self.failUnless(len(objects)==2)
+ self.failUnless('Cleese' in objects_names)
+ self.failUnless('Dard' in objects_names)
+
+ objects=ec.fetch('Writer', 'age not in [24, 82]')
+ objects_names=[o.getLastName() for o in objects]
+ self.failUnless(len(objects)==1)
+ self.failUnless('Rabelais' in objects_names)
+
+ objects=ec.fetch('Writer', 'age in [24]')
+ objects_names=[o.getLastName() for o in objects]
+ self.failUnless(len(objects)==1)
+ self.failUnless('Cleese' in objects_names)
+
def test_999_customSQLQuery(self):
"[EditingContext] customSQLQuery"
***************
*** 961,965 ****
sqlExpr.setStatement("delete from WRITER where id>3")
channel.evaluateExpression(sqlExpr)
-
def reinitDB():
--- 979,982 ----
Index: test_Qualifier.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_Qualifier.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_Qualifier.py 31 May 2003 10:16:58 -0000 1.8
--- test_Qualifier.py 10 Jul 2003 11:57:55 -0000 1.9
***************
*** 308,312 ****
self.failUnless(res and len(res)==1 and self.dummy in res)
del Writer.getAGE
!
# Build the test suite
def test_suite():
--- 308,324 ----
self.failUnless(res and len(res)==1 and self.dummy in res)
del Writer.getAGE
!
! def test_08_operator_in_not_in(self):
! "[Qualifier] IN and NOT IN operators"
! m_s=qualifierWithQualifierFormat('age IN [ 30, 70 ]')
! res=filteredArrayWithQualifier(self.authors, m_s)
! self.failUnless(len(res)==2 and self.jean in res and self.john in res)
! m_s=qualifierWithQualifierFormat('age IN [ 30 ]') # single item
! res=filteredArrayWithQualifier(self.authors, m_s)
! self.failUnless(len(res)==1 and self.john in res)
! m_s=qualifierWithQualifierFormat('age NOT IN [ 30, 70 ]')
! res=filteredArrayWithQualifier(self.authors, m_s)
! self.failUnless(len(res)==3 and self.douglas in res and self.victor in res and self.dummy in res)
!
# Build the test suite
def test_suite():
|