[Zope-Checkins] CVS: Zope/lib/python/Products/ZCTextIndex/tests - mhindex.py:1.17.8.1 testLexicon.py:1.3.34.1 testStopper.py:1.2.34.1

Andreas Jung andreas@andreas-jung.com
Sun, 15 Dec 2002 06:19:36 -0500


Update of /cvs-repository/Zope/lib/python/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv5114/tests

Modified Files:
      Tag: ajung-oneindex-multipleattributes-branch
	mhindex.py testLexicon.py testStopper.py 
Log Message:
merge from HEAD


=== Zope/lib/python/Products/ZCTextIndex/tests/mhindex.py 1.17 => 1.17.8.1 ===
--- Zope/lib/python/Products/ZCTextIndex/tests/mhindex.py:1.17	Tue Oct 15 20:38:16 2002
+++ Zope/lib/python/Products/ZCTextIndex/tests/mhindex.py	Sun Dec 15 06:19:36 2002
@@ -468,7 +468,7 @@
             self.index.index_text(docid, text)
             self.maycommit()
         # Remove messages from the folder that no longer exist
-        for path in self.path2docid.keys(f.name):
+        for path in list(self.path2docid.keys(f.name)):
             if not path.startswith(f.name + "/"):
                 break
             if self.getmtime(path) == 0:


=== Zope/lib/python/Products/ZCTextIndex/tests/testLexicon.py 1.3 => 1.3.34.1 ===
--- Zope/lib/python/Products/ZCTextIndex/tests/testLexicon.py:1.3	Thu May 16 15:51:12 2002
+++ Zope/lib/python/Products/ZCTextIndex/tests/testLexicon.py	Sun Dec 15 06:19:36 2002
@@ -12,6 +12,7 @@
 #
 ##############################################################################
 
+import sys
 from unittest import TestCase, TestSuite, main, makeSuite
 
 from Products.ZCTextIndex.Lexicon import Lexicon
@@ -112,7 +113,24 @@
         wids = lexicon.sourceToWordIds('cats and dogs')
         wids = lexicon.termToWordIds('hsif')
         self.assertEqual(wids, [2])
-
+        
+    def testSplitterLocaleAwareness(self):
+        from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter
+        import locale
+        loc = locale.setlocale(locale.LC_ALL) # get current locale
+         # set German locale
+        if sys.platform != 'win32':
+            locale.setlocale(locale.LC_ALL, 'de_DE.ISO8859-1')
+        else:
+            locale.setlocale(locale.LC_ALL, 'German_Germany.1252')
+        words = ['mülltonne waschbär behörde überflieger']
+        words = Splitter().process(words)
+        self.assertEqual(
+            words, ['mülltonne', 'waschbär', 'behörde', 'überflieger'])
+        words = HTMLWordSplitter().process(words)
+        self.assertEqual(
+            words, ['mülltonne', 'waschbär', 'behörde', 'überflieger'])        
+        locale.setlocale(locale.LC_ALL, loc) # restore saved locale
 
 def test_suite():
     return makeSuite(Test)


=== Zope/lib/python/Products/ZCTextIndex/tests/testStopper.py 1.2 => 1.2.34.1 ===
--- Zope/lib/python/Products/ZCTextIndex/tests/testStopper.py:1.2	Wed May 22 12:44:54 2002
+++ Zope/lib/python/Products/ZCTextIndex/tests/testStopper.py	Sun Dec 15 06:19:36 2002
@@ -1,3 +1,16 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
 """Tests for the C version of the StopWordRemover."""
 
 import unittest