[Checkins] SVN: zc.catalog/trunk/ test and bug fix. Thanks to Nando Quintana. Will also port to 1.1 branch (code will look a bit different, but similar).

Gary Poster gary at zope.com
Sat Mar 17 20:34:40 EDT 2007


Log message for revision 73305:
  test and bug fix.  Thanks to Nando Quintana.  Will also port to 1.1 branch (code will look a bit different, but similar).

Changed:
  U   zc.catalog/trunk/buildout.cfg
  U   zc.catalog/trunk/setup.py
  U   zc.catalog/trunk/src/zc/catalog/index.py
  U   zc.catalog/trunk/src/zc/catalog/setindex.txt
  U   zc.catalog/trunk/src/zc/catalog/tests.py

-=-
Modified: zc.catalog/trunk/buildout.cfg
===================================================================
--- zc.catalog/trunk/buildout.cfg	2007-03-17 19:18:45 UTC (rev 73304)
+++ zc.catalog/trunk/buildout.cfg	2007-03-18 00:34:39 UTC (rev 73305)
@@ -11,5 +11,5 @@
 
 [zope3]
 recipe = zc.recipe.zope3checkout
-url = svn://svn.zope.org/repos/main/Zope3/branches/3.3
+url = svn://svn.zope.org/repos/main/Zope3/trunk
 

Modified: zc.catalog/trunk/setup.py
===================================================================
--- zc.catalog/trunk/setup.py	2007-03-17 19:18:45 UTC (rev 73304)
+++ zc.catalog/trunk/setup.py	2007-03-18 00:34:39 UTC (rev 73305)
@@ -18,9 +18,7 @@
     author_email='zope3-dev at zope.org',
     description="zc.catalog contains a number of extensions to the Zope 3 catalog",
     long_description=(
-    open('README.txt').read()
-    + '\n' +
-    open('CHANGES.txt').read()),
+        open('README.txt').read() + '\n' + open('CHANGES.txt').read()),
     license='ZPL',
     keywords="zope zope3 indexing",
     classifiers = ['Framework :: Zope3'],

Modified: zc.catalog/trunk/src/zc/catalog/index.py
===================================================================
--- zc.catalog/trunk/src/zc/catalog/index.py	2007-03-17 19:18:45 UTC (rev 73304)
+++ zc.catalog/trunk/src/zc/catalog/index.py	2007-03-18 00:34:39 UTC (rev 73305)
@@ -267,16 +267,18 @@
         elif query_type == 'all_of':
             res = None
             values = iter(query)
+            empty = self.BTreeAPI.TreeSet()
             try:
-                res = values_to_documents.get(values.next())
+                res = values_to_documents.get(values.next(), empty)
             except StopIteration:
-                res = self.BTreeAPI.TreeSet()
+                res = empty
             while res:
                 try:
                     v = values.next()
                 except StopIteration:
                     break
-                res = self.BTreeAPI.intersection(res, values_to_documents.get(v))
+                res = self.BTreeAPI.intersection(
+                    res, values_to_documents.get(v, empty))
         elif query_type == 'between':
             res = self.BTreeAPI.Bucket()
             for v in values_to_documents.keys(*query):

Modified: zc.catalog/trunk/src/zc/catalog/setindex.txt
===================================================================
--- zc.catalog/trunk/src/zc/catalog/setindex.txt	2007-03-17 19:18:45 UTC (rev 73304)
+++ zc.catalog/trunk/src/zc/catalog/setindex.txt	2007-03-18 00:34:39 UTC (rev 73305)
@@ -98,9 +98,9 @@
     >>> list(index.apply({'any': limited_extent}))
     [1, 2, 3, 4]
 
-The 'contains_all' argument also takes an iterable of values, but returns an
+The 'all_of' argument also takes an iterable of values, but returns an
 iterable of document ids that contains all of the values.  The results are not
-weighted.
+weighted [#all_of_regression_test]_.
 
     >>> list(index.apply({'all_of': ('a',)}))
     [1, 2, 9]
@@ -229,3 +229,10 @@
     >>> index.containsValue(20)
     False
 
+.. [#all_of_regression_test] These tests illustrate two related reported
+    errors that have been fixed.
+
+    >>> list(index.apply({'all_of': ('z', 3, 4)}))
+    []
+    >>> list(index.apply({'all_of': (3, 4, 'z')}))
+    []

Modified: zc.catalog/trunk/src/zc/catalog/tests.py
===================================================================
--- zc.catalog/trunk/src/zc/catalog/tests.py	2007-03-17 19:18:45 UTC (rev 73304)
+++ zc.catalog/trunk/src/zc/catalog/tests.py	2007-03-18 00:34:39 UTC (rev 73305)
@@ -68,7 +68,8 @@
         doctest.DocFileSuite(
             'extentcatalog.txt', setUp=modSetUp, tearDown=modTearDown,
             optionflags=doctest.INTERPRET_FOOTNOTES),
-        doctest.DocFileSuite('setindex.txt'),
+        doctest.DocFileSuite(
+            'setindex.txt', optionflags=doctest.INTERPRET_FOOTNOTES),
         doctest.DocFileSuite('valueindex.txt'),
         doctest.DocFileSuite('normalizedindex.txt'),
         doctest.DocFileSuite('globber.txt'),



More information about the Checkins mailing list