Test for scripts ================ This test suite tests various python scripts. Ultimately these tests should be doctests provided directly in the implementation (as utilities for example). Tests for returnNone.py ----------------------- This should be self-explanatory: >>> self.portal.returnNone() is None True Tests for reverseList.py ------------------------ Test with a list: >>> self.portal.reverseList([1, 2, 3]) [3, 2, 1] Test with a dict: >>> self.portal.reverseList((1, 2, 3)) [3, 2, 1] Tests for spamProtect.py ------------------------ Test with only one argument: >>> self.portal.spamProtect('mailto:spam@plone.org') 'mailto:spam@plone.org' Also provide a second name argument: >>> self.portal.spamProtect('mailto:spam@plone.org', 'send your spam here') 'send your spam here' Tests for unique.py ------------------- Test a list of numbers which contains duplicates: >>> self.portal.unique([1,2,3,1,2,3]) [1, 2, 3] Test a string sequence: >>> self.portal.unique('abcabc') ['a', 'c', 'b'] And finally a tuple of lists: >>> self.portal.unique(([1, 2], [2, 3], [1, 2])) [[1, 2], [2, 3]] Test cropText.py ---------------- Test ascii text cropping >>> self.portal.cropText('Hello world', 7) 'Hello ...' >>> self.portal.cropText('Hello world', 99) 'Hello world' >>> self.portal.cropText('Hello world', 10) 'Hello worl...' Test unicode text cropping >>> self.portal.cropText(u'Hello world', 10) u'Hello worl...' >>> self.portal.cropText(u'Koko\u0159\xedn', 5) u'Koko\u0159...' Test utf encoded string Kokorin with 'r' and 'i' accented Must return 6 characters, because 5th character is two byte >>> text = u'Koko\u0159\xedn'.encode('utf8') >>> self.portal.cropText(text, 5) 'Koko\xc5\x99...'