97 def test_headers(self): |
97 def test_headers(self): |
98 self.skip('implement me') |
98 self.skip('implement me') |
99 |
99 |
100 def test_sortvalue(self): |
100 def test_sortvalue(self): |
101 e, _, view = self._prepare_entity() |
101 e, _, view = self._prepare_entity() |
102 expected = ['<toto>', 'loo"ong blabla'[:10], e.creation_date.strftime('%Y-%m-%d %H:%M')] |
102 expected = ['<toto>', 'loo"ong blabla'[:10], e.creation_date.strftime('%Y/%m/%d %H:%M:%S')] |
103 got = [loadjson(view.sortvalue(0, i)) for i in xrange(3)] |
103 got = [loadjson(view.sortvalue(0, i)) for i in xrange(3)] |
104 self.assertListEqual(got, expected) |
104 self.assertListEqual(got, expected) |
105 # XXX sqlite does not handle Interval correctly |
105 # XXX sqlite does not handle Interval correctly |
106 # value = loadjson(view.sortvalue(0, 3)) |
106 # value = loadjson(view.sortvalue(0, 3)) |
107 # self.assertAlmostEquals(value, rset.rows[0][3].seconds) |
107 # self.assertAlmostEquals(value, rset.rows[0][3].seconds) |
109 def test_sortvalue_with_display_col(self): |
109 def test_sortvalue_with_display_col(self): |
110 e, rset, view = self._prepare_entity() |
110 e, rset, view = self._prepare_entity() |
111 labels = view.columns_labels() |
111 labels = view.columns_labels() |
112 table = TableWidget(view) |
112 table = TableWidget(view) |
113 table.columns = view.get_columns(labels, [1, 2], None, None, None, None, 0) |
113 table.columns = view.get_columns(labels, [1, 2], None, None, None, None, 0) |
114 expected = ['loo"ong blabla'[:10], e.creation_date.strftime('%Y-%m-%d %H:%M')] |
114 expected = ['loo"ong blabla'[:10], e.creation_date.strftime('%Y/%m/%d %H:%M:%S')] |
115 got = [loadjson(value) for _, value in table.itercols(0)] |
115 got = [loadjson(value) for _, value in table.itercols(0)] |
116 self.assertListEqual(got, expected) |
116 self.assertListEqual(got, expected) |
117 |
117 |
118 |
118 |
119 if __name__ == '__main__': |
119 if __name__ == '__main__': |