Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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())
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
 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))
Ejemplo n.º 8
0
    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)