[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG/tests - testNormalizer.py:1.1.2.1

Andreas Jung andreas@digicool.com
Sun, 13 Jan 2002 12:41:50 -0500


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG/tests
In directory cvs.zope.org:/tmp/cvs-serv3839/tests

Added Files:
      Tag: ajung-textindexng-branch
	testNormalizer.py 
Log Message:
added


=== Added File Zope/lib/python/Products/PluginIndexes/TextIndexNG/tests/testNormalizer.py ===
##############################################################################
#
# Copyright (c) 2001 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
# 
##############################################################################

import sys, os, unittest

from Products.PluginIndexes.TextIndexNG.Normalizer import Normalizer 
from BTrees.IIBTree import IISet, difference

class Tests(unittest.TestCase):

    def setUp(self):
        self.N = Normalizer('default_de.txt')


    def testSimple(self):
        """ simple normalizer test """

        _data = (
            ('einen','einen'), 
            ('alle','alle'),
            ('Flugplätze','Flugplaetze'), 
            ('zerstört','zerstoert'),  
        )

        for w1,w2 in _data:
            self.assertEqual( self.N(w1), w2, (w1,w2,self.N(w1)))
        

       

def test_suite():
   return unittest.makeSuite(Tests)

def main():
   unittest.TextTestRunner().run(test_suite())

def debug():
   test_suite().debug()

def pdebug():
    import pdb
    pdb.run('debug()')
   
if __name__=='__main__':
   if len(sys.argv) > 1:
      globals()[sys.argv[1]]()
   else:
      main()