[Zope-Checkins] CVS: Zope/lib/python/Products/ZCTextIndex/tests - mhindex.py:1.16.6.2 testLexicon.py:1.3.8.1 testStopper.py:1.2.8.1

Chris McDonough chrism@zope.com
Fri, 3 Jan 2003 01:33:55 -0500


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

Modified Files:
      Tag: chrism-install-branch
	mhindex.py testLexicon.py testStopper.py 
Log Message:
Merging chrism-install-branch with HEAD (hopefully for one of the last
times).



=== Zope/lib/python/Products/ZCTextIndex/tests/mhindex.py 1.16.6.1 => 1.16.6.2 ===
--- Zope/lib/python/Products/ZCTextIndex/tests/mhindex.py:1.16.6.1	Sat Oct 26 15:51:44 2002
+++ Zope/lib/python/Products/ZCTextIndex/tests/mhindex.py	Fri Jan  3 01:33:22 2003
@@ -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.8.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	Fri Jan  3 01:33:22 2003
@@ -12,6 +12,7 @@
 #
 ##############################################################################
 
+import sys
 from unittest import TestCase, TestSuite, main, makeSuite
 
 from Products.ZCTextIndex.Lexicon import Lexicon
@@ -112,7 +113,27 @@
         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
+        try:
+            if sys.platform != 'win32':
+                locale.setlocale(locale.LC_ALL, 'de_DE.ISO8859-1')
+            else:
+                locale.setlocale(locale.LC_ALL, 'German_Germany.1252')
+        except locale.Error:
+            return # This test doesn't work here :-(
+        expected = ['m\xfclltonne', 'waschb\xe4r',
+                    'beh\xf6rde', '\xfcberflieger']
+        words = [" ".join(expected)]
+        words = Splitter().process(words)
+        self.assertEqual(words, expected)
+        words = HTMLWordSplitter().process(words)
+        self.assertEqual(words, expected)
+        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.8.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	Fri Jan  3 01:33:22 2003
@@ -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