def testTestNoSortables(self): """ Test that the scrolltable can handle the case where all columns are unsortable """ sf = ScrollingFragment( self.store, DataThunk, None, (UnsortableColumn(DataThunk.a), UnsortableColumn(DataThunk.b))) self.assertEquals(sf.currentSortColumn, None)
def test_allUnsortableSortMetadata(self): """ Test that C{getTableMetadata} is correct with respect to the sortability of columns """ sf = ScrollingFragment( self.store, DataThunk, None, (UnsortableColumn(DataThunk.a), UnsortableColumn(DataThunk.b))) meta = sf.getTableMetadata() cols = meta[1] self.assertEquals(cols['a'][1], False) self.assertEquals(cols['b'][1], False)
def testSortsOnFirstSortable(self): """ Test that the scrolltable sorts on the first sortable column """ sf = ScrollingFragment(self.store, DataThunk, None, (UnsortableColumn(DataThunk.a), DataThunk.b)) self.assertEquals(sf.currentSortColumn, DataThunk.b)
def test_unsortableColumnType(self): """ L{UnsortableColumn.getType} should return the same value as L{AttributeColumn.getType} for a particular attribute. """ self.assertEqual( AttributeColumn(DataThunk.a).getType(), UnsortableColumn(DataThunk.a).getType())
def test_noSortableColumns(self): """ Attempting to construct a L{InequalityModel} without any sortable columns should result in a L{Unsortable} exception being thrown. """ makeModel = lambda: InequalityModel(self.store, DataThunk, None, [ UnsortableColumn(DataThunk.a) ], None, True) self.assertRaises(Unsortable, makeModel)
def testSortsOnFirstSortable2(self): """ Same as L{testSortsOnFirstSortable}, but for the case where the first sortable column is the first in the column list """ sf = ScrollingFragment(self.store, DataThunk, None, (DataThunk.a, UnsortableColumn(DataThunk.b))) self.assertIdentical(sf.currentSortColumn.sortAttribute(), DataThunk.a)
def test_unsortableColumnDeprecated(self): """ L{UnsortableColumn} is a deprecated almost-alias for L{UnsortableColumnWrapper}. """ self.assertWarns( DeprecationWarning, "Use UnsortableColumnWrapper(AttributeColumn(*a, **kw)) " "instead of UnsortableColumn(*a, **kw).", __file__, lambda: UnsortableColumn(DataThunk.a))
def test_oneSortableSortMetadata(self): """ Same as L{test_allUnsortableSortMetadata}, but with one sortable column """ sf = ScrollingFragment(self.store, DataThunk, None, (DataThunk.a, UnsortableColumn(DataThunk.b))) meta = sf.getTableMetadata() cols = meta[1] self.assertEquals(cols['a'][1], True) self.assertEquals(cols['b'][1], False)