[Checkins] SVN: zc.catalog/branches/1.1/ test and bug fix. Thanks
to Nando Quintana.
Gary Poster
gary at zope.com
Sat Mar 17 21:36:02 EDT 2007
Log message for revision 73306:
test and bug fix. Thanks to Nando Quintana.
Changed:
U zc.catalog/branches/1.1/CHANGES.txt
U zc.catalog/branches/1.1/setup.py
U zc.catalog/branches/1.1/src/zc/catalog/index.py
U zc.catalog/branches/1.1/src/zc/catalog/setindex.txt
U zc.catalog/branches/1.1/src/zc/catalog/tests.py
-=-
Modified: zc.catalog/branches/1.1/CHANGES.txt
===================================================================
--- zc.catalog/branches/1.1/CHANGES.txt 2007-03-18 00:34:39 UTC (rev 73305)
+++ zc.catalog/branches/1.1/CHANGES.txt 2007-03-18 01:36:01 UTC (rev 73306)
@@ -2,8 +2,17 @@
zc.catalog changes
==================
+1.1.1 (2007-3-17)
+=================
+
+Bugs fixed
+----------
+
+'all_of' would return all results when one of the values had no results.
+Reported, with test and fix provided, by Nando Quintana.
+
1.1 (2007-1-6)
-================
+==============
Features removed
----------------
Modified: zc.catalog/branches/1.1/setup.py
===================================================================
--- zc.catalog/branches/1.1/setup.py 2007-03-18 00:34:39 UTC (rev 73305)
+++ zc.catalog/branches/1.1/setup.py 2007-03-18 01:36:01 UTC (rev 73306)
@@ -3,7 +3,7 @@
setup(
name="zc.catalog",
- version="1.0",
+ version="1.1.1",
packages=find_packages('src', exclude=["*.tests", "*.ftests"]),
package_dir= {'':'src'},
@@ -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/branches/1.1/src/zc/catalog/index.py
===================================================================
--- zc.catalog/branches/1.1/src/zc/catalog/index.py 2007-03-18 00:34:39 UTC (rev 73305)
+++ zc.catalog/branches/1.1/src/zc/catalog/index.py 2007-03-18 01:36:01 UTC (rev 73306)
@@ -249,16 +249,18 @@
elif query_type == 'all_of':
res = None
values = iter(query)
+ empty = IFBTree.IFTreeSet()
try:
- res = values_to_documents.get(values.next())
+ res = values_to_documents.get(values.next(), empty)
except StopIteration:
- res = IFBTree.IFTreeSet()
+ res = empty
while res:
try:
v = values.next()
except StopIteration:
break
- res = IFBTree.intersection(res, values_to_documents.get(v))
+ res = IFBTree.intersection(
+ res, values_to_documents.get(v, empty))
elif query_type == 'between':
res = IFBTree.IFBucket()
for v in values_to_documents.keys(*query):
Modified: zc.catalog/branches/1.1/src/zc/catalog/setindex.txt
===================================================================
--- zc.catalog/branches/1.1/src/zc/catalog/setindex.txt 2007-03-18 00:34:39 UTC (rev 73305)
+++ zc.catalog/branches/1.1/src/zc/catalog/setindex.txt 2007-03-18 01:36:01 UTC (rev 73306)
@@ -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/branches/1.1/src/zc/catalog/tests.py
===================================================================
--- zc.catalog/branches/1.1/src/zc/catalog/tests.py 2007-03-18 00:34:39 UTC (rev 73305)
+++ zc.catalog/branches/1.1/src/zc/catalog/tests.py 2007-03-18 01:36:01 UTC (rev 73306)
@@ -33,7 +33,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