else:\r
return item in self.all()\r
\r
+ def __len__(self):\r
+ self._spawn_columns()\r
+ return len([1 for c in self._columns.values() if c.visible])\r
+\r
def __getitem__(self, name):\r
"""Return a column by name."""\r
self._spawn_columns()\r
assert 'motto' in StateTable2.base_columns
+def test_column_count():
+ class MyTable(TestTable):
+ visbible = tables.Column(visible=True)
+ hidden = tables.Column(visible=False)
+
+ # The columns container supports the len() builtin
+ assert len(MyTable([]).columns) == 1
+
+
def test_pagination():
class BookTable(TestTable):
name = tables.Column()