[CMF-checkins] CVS: CMF/CMFDefault/tests - test_utils.py:1.6
Tres Seaver
tseaver@zope.com
Wed, 13 Mar 2002 07:27:03 -0500
Update of /cvs-repository/CMF/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv2242/CMFDefault/tests
Modified Files:
test_utils.py
Log Message:
- Applied Lucas Hofman's patch (Tracker #479) to strip leading / trailing
whitespace from tuplized keywords.
=== CMF/CMFDefault/tests/test_utils.py 1.5 => 1.6 ===
-from Products.CMFDefault.utils import parseHeadersBody
+import Zope
+from Products.CMFDefault.utils import parseHeadersBody, tuplize, comma_split
+from Products.CMFDefault.utils import seq_strip
class DefaultUtilsTests(TestCase):
COMMON_HEADERS = '''Author: Tres Seaver
@@ -63,3 +65,15 @@
if __name__ == '__main__':
main(defaultTest='test_suite')
+
+ def test_tuplize( self ):
+ assert( tuplize('string', 'one two three') == ('one','two','three'))
+ assert( tuplize('string', 'one,two,three', comma_split) == ('one','two','three'))
+ assert( tuplize('list', ['one',' two','three ']) == ('one',' two','three '))
+ assert( tuplize('tuple', ('one','two','three')) == ('one','two','three'))
+
+ def test_seq_strip( self ):
+ assert( seq_strip(['one ', ' two', ' three '])
+ == ['one','two','three'])
+ assert( seq_strip(('one ', ' two', ' three '))
+ == ('one','two','three'))