[CMF-checkins] CVS: Products/CMFCore/tests - test_utils.py:1.4
Stefan H. Holek
stefan at epy.co.at
Sat Jul 31 08:58:43 EDT 2004
Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv5764/CMFCore/tests
Modified Files:
test_utils.py
Log Message:
Add contributorsplitter() utility function.
=== Products/CMFCore/tests/test_utils.py 1.3 => 1.4 ===
--- Products/CMFCore/tests/test_utils.py:1.3 Mon May 17 09:22:49 2004
+++ Products/CMFCore/tests/test_utils.py Sat Jul 31 08:58:37 2004
@@ -13,6 +13,8 @@
from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.utils import _checkPermission
from Products.CMFCore.utils import normalize
+from Products.CMFCore.utils import keywordsplitter
+from Products.CMFCore.utils import contributorsplitter
class DummyObject(Owned, DummyObject):
@@ -48,6 +50,43 @@
def test_normalize(self):
self.assertEqual( normalize('foo/bar'), 'foo/bar' )
self.assertEqual( normalize('foo\\bar'), 'foo/bar' )
+
+ def test_keywordsplitter_empty(self):
+ for x in [ '', ' ', ',', ',,', ';', ';;' ]:
+ self.assertEqual( keywordsplitter({'Keywords': x}),
+ [] )
+
+ def test_keywordsplitter_single(self):
+ for x in [ 'foo', ' foo ', 'foo,', 'foo ,,', 'foo;', 'foo ;;' ]:
+ self.assertEqual( keywordsplitter({'Keywords': x}),
+ ['foo'] )
+
+ def test_keywordsplitter_multi(self):
+ for x in [ 'foo, bar, baz'
+ , 'foo, bar , baz'
+ , 'foo, bar,, baz'
+ , 'foo; bar; baz'
+ ]:
+ self.assertEqual( keywordsplitter({'Keywords': x}),
+ ['foo', 'bar', 'baz'] )
+
+ def test_contributorsplitter_emtpy(self):
+ for x in [ '', ' ', ';', ';;' ]:
+ self.assertEqual( contributorsplitter({'Contributors': x}),
+ [] )
+
+ def test_contributorsplitter_single(self):
+ for x in [ 'foo', ' foo ', 'foo;', 'foo ;;' ]:
+ self.assertEqual( contributorsplitter({'Contributors': x}),
+ ['foo'] )
+
+ def test_contributorsplitter_multi(self):
+ for x in [ 'foo; bar; baz'
+ , 'foo; bar ; baz'
+ , 'foo; bar;; baz'
+ ]:
+ self.assertEqual( contributorsplitter({'Contributors': x}),
+ ['foo', 'bar', 'baz'] )
def test_suite():
More information about the CMF-checkins
mailing list