Back to index

plone3  3.1.7
Public Member Functions
Archetypes.tests.test_utils.DisplayListTest Class Reference
Inheritance diagram for Archetypes.tests.test_utils.DisplayListTest:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.tests.test_utils.DisplayListTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_cmp
def test_slice
def test_item
def test_add
def test_len
def test_keys
def test_values
def test_items
def test_repr
def test_str
def test_call
def test_getmsgid
def test_concat
def test_sort

Detailed Description

Definition at line 46 of file test_utils.py.


Member Function Documentation

Definition at line 72 of file test_utils.py.

00072 
00073     def test_add(self):
00074         ta = ('a', 'b', 'c')
00075         l = zip(ta, ta)
00076         dl = DisplayList(l)[:]
00077         self.failUnless(dl == l)
00078         l.append(('d', 'd'))
00079         dl.append(('d', 'd'))
00080         self.failUnless(dl == l)

Definition at line 117 of file test_utils.py.

00117 
00118     def test_call(self):
00119         ta = ('a', 'b', 'c')
00120         l = zip(ta, ta)
00121         dl = DisplayList(l)
00122         self.failUnless(dl == dl)
00123         self.failUnless(dl() == dl())
00124         self.failUnless(dl[:] == l)
00125         self.failUnless(dl()[:] == l)

Definition at line 48 of file test_utils.py.

00048 
00049     def test_cmp(self):
00050         ta = ('a', 'b', 'c')
00051         tb = ('a', 'c', 'b')
00052         tc = ('a', 'c', 'c')
00053         td = ('c', 'b', 'a')
00054         self.failUnless(DisplayList(zip(ta, ta)) == DisplayList(zip(ta, ta)))
00055         self.failIf(DisplayList(zip(ta, ta)) == DisplayList(zip(ta, tb)))
00056         self.failUnless(DisplayList(zip(ta, ta)) == DisplayList(zip(td, td)))
00057         self.failUnless(DisplayList(zip(tb, ta)) == DisplayList(zip(tb, ta)))
00058         self.assertRaises(TypeError, cmp, DisplayList(), '')

Definition at line 132 of file test_utils.py.

00132 
00133     def test_concat(self):
00134         a = (('a','a',), ('b','b','bb'), ('c', 'c'))
00135         b = (('a','a','aa'), ('b','b'), ('c', 'c'))
00136         bzz, jzz = DisplayList(a), DisplayList(b)
00137         wahaaa = bzz + jzz
00138         self.failUnless(wahaaa.getMsgId('b') == 'bb')
00139         self.failUnless(wahaaa.getMsgId('a') == 'aa')

Definition at line 126 of file test_utils.py.

00126 
00127     def test_getmsgid(self):
00128         ta = (('a','a',), ('b','b','bb'), ('c', 'c'))
00129         dl = DisplayList(ta)
00130         self.assertEquals(dl.getMsgId('a'), 'a')
00131         self.assertEquals(dl.getMsgId('b'), 'bb')

Definition at line 65 of file test_utils.py.

00065 
00066     def test_item(self):
00067         ta = ('a', 'b', 'c')
00068         l = zip(ta, ta)
00069         for i in range(0,2):
00070             item = ta[i]
00071             self.failUnless(DisplayList(l)[i] == item)

Definition at line 99 of file test_utils.py.

00099 
00100     def test_items(self):
00101         ta = ('a', 'b', 'c')
00102         l = zip(ta, ta)
00103         dl = DisplayList(l)
00104         self.failUnless(dl.items() == tuple(l))

Definition at line 87 of file test_utils.py.

00087 
00088     def test_keys(self):
00089         ta = ('a', 'b', 'c')
00090         l = zip(ta, ta)
00091         dl = DisplayList(l)
00092         self.failUnless(tuple(dl.keys()) == ta)

Definition at line 81 of file test_utils.py.

00081 
00082     def test_len(self):
00083         ta = ('a', 'b', 'c')
00084         l = zip(ta, ta)
00085         dl = DisplayList(l)
00086         self.failUnless(len(dl) == len(l))

Definition at line 105 of file test_utils.py.

00105 
00106     def test_repr(self):
00107         ta = ('a', 'b', 'c')
00108         l = zip(ta, ta)
00109         dl = DisplayList(l)
00110         self.failUnless(repr(dl).find(str(l)))

Definition at line 59 of file test_utils.py.

00059 
00060     def test_slice(self):
00061         ta = ('a', 'b', 'c')
00062         l = zip(ta, ta)
00063         sub = l[1:]
00064         self.failUnless(DisplayList(l)[1:] == sub)

Definition at line 140 of file test_utils.py.

00140 
00141     def test_sort(self):
00142         a = (('a','a',), ('b','b'), ('c', 'c'))
00143         b = (('z','Z',), ('y','Y'), ('x', 'X'))
00144         c = (('a','Z',), ('c','Y'), ('b', 'X'))
00145         dla = DisplayList(a)
00146         dlb = DisplayList(b)
00147         dlc = DisplayList(c)
00148 
00149         assert dla.values() == ['a', 'b', 'c']
00150         dlb_s = dlb.sortedByValue()
00151         assert dlb_s.values() == ['X', 'Y', 'Z']
00152         dlc_s = dlc.sortedByKey()
00153         assert dlc_s.values() == ['Z', 'X', 'Y']
        

Definition at line 111 of file test_utils.py.

00111 
00112     def test_str(self):
00113         ta = ('a', 'b', 'c')
00114         l = zip(ta, ta)
00115         dl = DisplayList(l)
00116         self.failUnless(str(dl) == str(l))

Definition at line 93 of file test_utils.py.

00093 
00094     def test_values(self):
00095         ta = ('a', 'b', 'c')
00096         l = zip(ta, ta)
00097         dl = DisplayList(l)
00098         self.failUnless(tuple(dl.values()) == ta)


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