[Zope-Checkins] SVN: Zope/trunk/ Centralize interfaces defined in Products.ZCTextIndex.
Log message for revision 100817: Centralize interfaces defined in Products.ZCTextIndex. o Leave BBB imports behind in old locations. Changed: U Zope/trunk/doc/CHANGES.rst U Zope/trunk/src/Products/ZCTextIndex/BaseIndex.py U Zope/trunk/src/Products/ZCTextIndex/CosineIndex.py U Zope/trunk/src/Products/ZCTextIndex/HTMLSplitter.py U Zope/trunk/src/Products/ZCTextIndex/IIndex.py U Zope/trunk/src/Products/ZCTextIndex/INBest.py U Zope/trunk/src/Products/ZCTextIndex/IPipelineElement.py U Zope/trunk/src/Products/ZCTextIndex/IPipelineElementFactory.py U Zope/trunk/src/Products/ZCTextIndex/IQueryParseTree.py U Zope/trunk/src/Products/ZCTextIndex/IQueryParser.py U Zope/trunk/src/Products/ZCTextIndex/ISplitter.py U Zope/trunk/src/Products/ZCTextIndex/Lexicon.py U Zope/trunk/src/Products/ZCTextIndex/NBest.py U Zope/trunk/src/Products/ZCTextIndex/OkapiIndex.py U Zope/trunk/src/Products/ZCTextIndex/ParseTree.py U Zope/trunk/src/Products/ZCTextIndex/PipelineFactory.py U Zope/trunk/src/Products/ZCTextIndex/QueryParser.py U Zope/trunk/src/Products/ZCTextIndex/interfaces.py U Zope/trunk/src/Products/ZCTextIndex/tests/testParseTree.py U Zope/trunk/src/Products/ZCTextIndex/tests/testPipelineFactory.py U Zope/trunk/src/Products/ZCTextIndex/tests/testQueryParser.py -=- Modified: Zope/trunk/doc/CHANGES.rst === --- Zope/trunk/doc/CHANGES.rst 2009-06-10 22:10:07 UTC (rev 100816) +++ Zope/trunk/doc/CHANGES.rst 2009-06-10 22:29:12 UTC (rev 100817) @@ -11,14 +11,17 @@ Restructuring + -* Integrated zLOG package back into this package. +- Centralize interfaces defined in Products.ZCTextIndex, leaving BBB + imports behind in old locations. -* Updated documentation to new version number. +- Integrated zLOG package back into this package. +- Updated documentation to new version number. + Features Added ++ -* Updated packages: +- Updated packages: - zope.app.cache = 3.6.0 - zope.app.pagetemplate = 3.7.1 Modified: Zope/trunk/src/Products/ZCTextIndex/BaseIndex.py === --- Zope/trunk/src/Products/ZCTextIndex/BaseIndex.py2009-06-10 22:10:07 UTC (rev 100816) +++ Zope/trunk/src/Products/ZCTextIndex/BaseIndex.py2009-06-10 22:29:12 UTC (rev 100817) @@ -27,8 +27,8 @@ from Persistence import Persistent from zope.interface import implements -from Products.ZCTextIndex.IIndex import IIndex from Products.ZCTextIndex import WidCode +from Products.ZCTextIndex.interfaces import IIndex from Products.ZCTextIndex.SetOps import mass_weightedIntersection from Products.ZCTextIndex.SetOps import mass_weightedUnion Modified: Zope/trunk/src/Products/ZCTextIndex/CosineIndex.py === --- Zope/trunk/src/Products/ZCTextIndex/CosineIndex.py 2009-06-10 22:10:07 UTC (rev 100816) +++ Zope/trunk/src/Products/ZCTextIndex/CosineIndex.py 2009-06-10 22:29:12 UTC (rev 100817) @@ -19,7 +19,7 @@ from BTrees.IIBTree import IIBucket from zope.interface import implements -from Products.ZCTextIndex.IIndex import IIndex +from Products.ZCTextIndex.interfaces import IIndex from Products.ZCTextIndex.BaseIndex import BaseIndex from Products.ZCTextIndex.BaseIndex import inverse_doc_frequency from Products.ZCTextIndex.BaseIndex import scaled_int Modified: Zope/trunk/src/Products/ZCTextIndex/HTMLSplitter.py === --- Zope/trunk/src/Products/ZCTextIndex/HTMLSplitter.py 2009-06-10 22:10:07 UTC (rev 100816) +++ Zope/trunk/src/Products/ZCTextIndex/HTMLSplitter.py 2009-06-10 22:29:12 UTC (rev 100817) @@ -15,7 +15,7 @@ from zope.interface import implements -from Products.ZCTextIndex.ISplitter import ISplitter +from Products.ZCTextIndex.interfaces import ISplitter from Products.ZCTextIndex.PipelineFactory import element_factory class HTMLWordSplitter: Modified: Zope/trunk/src/Products/ZCTextIndex/IIndex.py === --- Zope/trunk/src/Products/ZCTextIndex/IIndex.py 2009-06-10 22:10:07 UTC (rev 100816) +++ Zope/trunk/src/Products/ZCTextIndex/IIndex.py 2009-06-10 22:29:12 UTC (rev 100817) @@ -14,67 +14,4 @@ Index Interface. -from zope.interface import Interface - -class IIndex(Interface): -Interface for an Index. - -def length(): -Return the number of words in the index. - -def document_count(): -Return the number of documents in the index. - -def get_words(docid): -Return a list of wordids for the given docid. - -def search(term): -Execute a search on a single term given as a string. - -Return an IIBTree mapping docid to score, or None if all docs -match due to the lexicon returning no wids for the term (e.g., -
[Zope-Checkins] SVN: Zope/trunk/src/Products/ZCTextIndex/tests/testHTMLSplitter.py Add tests for HTMLSplitter.
Log message for revision 100818: Add tests for HTMLSplitter. Changed: A Zope/trunk/src/Products/ZCTextIndex/tests/testHTMLSplitter.py -=- Added: Zope/trunk/src/Products/ZCTextIndex/tests/testHTMLSplitter.py === --- Zope/trunk/src/Products/ZCTextIndex/tests/testHTMLSplitter.py (rev 0) +++ Zope/trunk/src/Products/ZCTextIndex/tests/testHTMLSplitter.py 2009-06-10 22:29:44 UTC (rev 100818) @@ -0,0 +1,77 @@ +## +# +# Copyright (c) 2009 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +## +Test zope.index.text.htmlsplitter + +import unittest + +class HTMLWordSplitterTests(unittest.TestCase): +# Subclasses must define '_getBTreesFamily' +def _getTargetClass(self): +from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter +return HTMLWordSplitter + +def _makeOne(self): +return self._getTargetClass()() + +def test_class_conforms_to_ISplitter(self): +from zope.interface.verify import verifyClass +from Products.ZCTextIndex.interfaces import ISplitter +verifyClass(ISplitter, self._getTargetClass()) + +def test_instance_conforms_to_ISplitter(self): +from zope.interface.verify import verifyObject +from Products.ZCTextIndex.interfaces import ISplitter +verifyObject(ISplitter, self._makeOne()) + +def test_process_empty_string(self): +splitter = self._makeOne() +self.assertEqual(splitter.process(['']), []) + +def test_process_no_markup(self): +splitter = self._makeOne() +self.assertEqual(splitter.process(['abc def']), ['abc', 'def']) + +def test_process_w_markup(self): +splitter = self._makeOne() +self.assertEqual(splitter.process(['h1abc/h1 nbsp; pdef/p']), + ['abc', 'def']) + +def test_process_no_markup_w_glob(self): +splitter = self._makeOne() +self.assertEqual(splitter.process(['abc?def hij*klm nop* qrs?']), + ['abc', 'def', 'hij', 'klm', 'nop', 'qrs']) + +def test_processGlob_empty_string(self): +splitter = self._makeOne() +self.assertEqual(splitter.processGlob(['']), []) + +def test_processGlob_no_markup_no_glob(self): +splitter = self._makeOne() +self.assertEqual(splitter.processGlob(['abc def']), ['abc', 'def']) + +def test_processGlob_w_markup_no_glob(self): +splitter = self._makeOne() +self.assertEqual(splitter.processGlob(['h1abc/h1 nbsp; ' + 'pdef/p']), + ['abc', 'def']) + +def test_processGlob_no_markup_w_glob(self): +splitter = self._makeOne() +self.assertEqual(splitter.processGlob(['abc?def hij*klm nop* qrs?']), + ['abc?def', 'hij*klm', 'nop*', 'qrs?']) + +def test_suite(): +return unittest.TestSuite(( +unittest.makeSuite(HTMLWordSplitterTests), +)) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins