Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
ATContentTypes.tests.test_skinScripts.TestFormatCatalogMetadata Class Reference
Inheritance diagram for ATContentTypes.tests.test_skinScripts.TestFormatCatalogMetadata:
Inheritance graph
[legend]
Collaboration diagram for ATContentTypes.tests.test_skinScripts.TestFormatCatalogMetadata:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testFormatDate
def testFormatDict
def testFormatList
def testFormatString
def testFormatTruncates
def testFormatStrange
def testUnicodeValue

Public Attributes

 script

Detailed Description

Definition at line 33 of file test_skinScripts.py.


Member Function Documentation

Definition at line 35 of file test_skinScripts.py.

00035 
00036     def afterSetUp(self):
00037         atcttestcase.ATCTSiteTestCase.afterSetUp(self)
00038         self.script = self.portal.formatCatalogMetadata

Definition at line 39 of file test_skinScripts.py.

00039 
00040     def testFormatDate(self):
00041         date = '2005-11-02 13:52:25'
00042         format = '%m-%d-%Y %I:%M %p'
00043         self.portal.portal_properties.site_properties.manage_changeProperties(
00044                             localLongTimeFormat='%m-%d-%Y %I:%M %p')
00045         self.assertEqual(self.script(date),
00046                          DateTime(date).strftime(format))
00047         self.assertEqual(self.script(DateTime(date)),
00048                          DateTime(date).strftime(format))

Definition at line 49 of file test_skinScripts.py.

00049 
00050     def testFormatDict(self):
00051         self.assertEqual(self.script({'a':1,'b':2}), 'a: 1, b: 2')

Definition at line 52 of file test_skinScripts.py.

00052 
00053     def testFormatList(self):
00054         self.assertEqual(self.script(('a','b',1,2,3,4)), 'a, b, 1, 2, 3, 4')
00055         self.assertEqual(self.script(['a','b',1,2,3,4]), 'a, b, 1, 2, 3, 4')
00056         # this also needs to be able to handle unicode that won't encode to ascii
00057         ustr = 'i\xc3\xadacute'.decode('utf8')
00058         self.assertEqual(self.script(['a','b',ustr]), 'a, b, i\xc3\xadacute'.decode('utf8'))

Here is the call graph for this function:

Definition at line 67 of file test_skinScripts.py.

00067 
00068     def testFormatStrange(self):
00069         self.assertEqual(self.script(None), '')
00070         self.assertEqual(self.script(Missing.Value()), '')

Definition at line 59 of file test_skinScripts.py.

00059 
00060     def testFormatString(self):
00061         self.assertEqual(self.script('fkj dsh ekjhsdf kjer'), 'fkj dsh ekjhsdf kjer')

Definition at line 62 of file test_skinScripts.py.

00062 
00063     def testFormatTruncates(self):
00064         self.portal.portal_properties.site_properties.manage_changeProperties(
00065                             search_results_description_length=12, ellipsis='???')
00066         self.assertEqual(self.script('fkj dsh ekjhsdf kjer'), 'fkj dsh ekjh???')

Make sure non-ascii encodable unicode is acceptable 

Definition at line 71 of file test_skinScripts.py.

00071 
00072     def testUnicodeValue(self):
00073         """ Make sure non-ascii encodable unicode is acceptable """
00074         
00075         ustr = 'i\xc3\xadacute'.decode('utf8')
00076         self.assertEqual(self.script(ustr), ustr)
00077 
00078 tests.append(TestFormatCatalogMetadata)

Here is the call graph for this function:


Member Data Documentation

Definition at line 37 of file test_skinScripts.py.


The documentation for this class was generated from the following file: