[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG/tests - testGlobbingLexiconNG.py:1.1.2.2
Andreas Jung
andreas@digicool.com
Wed, 9 Jan 2002 16:01:36 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG/tests
In directory cvs.zope.org:/tmp/cvs-serv5084
Modified Files:
Tag: ajung-textindexng-branch
testGlobbingLexiconNG.py
Log Message:
update
=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/tests/testGlobbingLexiconNG.py 1.1.2.1 => 1.1.2.2 ===
l2.sort()
- print l1,l2
return l1,l2
@@ -56,6 +55,10 @@
apply(self.assertEqual, c('the', 't*'))
apply(self.assertEqual, c('the', 'th*'))
apply(self.assertEqual, c('the', 'the*'))
+
+ apply(self.assertEqual, c('the', 'th?'))
+ apply(self.assertEqual, c('the', 't?e'))
+ apply(self.assertEqual, c('the', '?he*'))
apply(self.assertEqual, c('brown', 'b*'))
apply(self.assertEqual, c('brown', 'br*'))
@@ -63,9 +66,26 @@
apply(self.assertEqual, c('brown', 'brow*'))
apply(self.assertEqual, c('brown', 'brown*'))
+ apply(self.assertEqual, c('brown', 'brow?'))
+ apply(self.assertEqual, c('brown', 'bro?n'))
+ apply(self.assertEqual, c('brown', 'br?wn'))
+ apply(self.assertEqual, c('brown', 'b?own'))
+ apply(self.assertEqual, c('brown', '?rown'))
+
+ apply(self.assertEqual, c('brown', 'brow?'))
+ apply(self.assertEqual, c('brown', 'b?o?n'))
+ apply(self.assertEqual, c('brown', '?r?wn'))
+ apply(self.assertEqual, c('brown', 'b??wn'))
+ apply(self.assertEqual, c('brown', '?ro?n'))
+
+ apply(self.assertEqual, c('brown', 'b?*'))
+ apply(self.assertEqual, c('brown', 'b?o?n'))
+ apply(self.assertEqual, c('brown', 'br??*'))
+
+
def testLatin1Globbing(self):
- """ test simple globbing functionality """
+ """ test Latin1 functionality """
L = self._lexicon
@@ -83,19 +103,33 @@
apply(self.assertEqual, c('seien', 'seie*'))
apply(self.assertEqual, c('seien', 'seien*'))
- self.printLexicon()
apply(self.assertEqual, c('dreitägigen', 'drei*'))
apply(self.assertEqual, c('dreitägigen', 'dreit*'))
apply(self.assertEqual, c('dreitägigen', 'dreitä*'))
apply(self.assertEqual, c('dreitägigen', 'dreitägig*'))
+ apply(self.assertEqual, c('dreitägigen', 'dreit?gigen'))
+ apply(self.assertEqual, c('dreitägigen', 'dreitä?igen'))
+ apply(self.assertEqual, c('dreitägigen', 'dreit????en'))
+ apply(self.assertEqual, c('dreitägigen', 'dreit????en'))
+ apply(self.assertEqual, c('dreitägigen', 'd??????????'))
+
+
def testUnicodeGlobbing(self):
- """ test simple globbing functionality """
+ """ test unicode functionality (known to fail
+ with defaultencoding=ascii)
+ """
+
+ import sys
+
+ if sys.getdefaultencoding()=='ascii':
+ print 'Warning: this test is known to fail '\
+ 'with defaultencoding="ascii"'
L = self._lexicon
- s = unicode('Bei den dreitägigen Angriffen seien auch bis','latin1')
+ s = unicode('dreitägigen seien','latin1')
words = s.split()
wids = {}
@@ -109,15 +143,20 @@
apply(self.assertEqual, c('seien', 'seie*'))
apply(self.assertEqual, c('seien', 'seien*'))
- self.printLexicon()
+ apply(self.assertEqual, c('seien', 'seie?'))
+ apply(self.assertEqual, c('seien', 'se??n'))
+ apply(self.assertEqual, c('seien', 's???n'))
+ apply(self.assertEqual, c('seien', 's????'))
+
apply(self.assertEqual, c('dreitägigen', 'drei*'))
apply(self.assertEqual, c('dreitägigen', 'dreit*'))
apply(self.assertEqual, c('dreitägigen', 'dreitä*'))
apply(self.assertEqual, c('dreitägigen', 'dreitägig*'))
+
def test_suite():
- return unittest.makeSuite(Tests)
+ return unittest.makeSuite(Tests,'test')
def main():
unittest.TextTestRunner().run(test_suite())