def test_column_declaration(self):
     """Test standard column declaration styles."""
     grid = DataGrid(name='grid', fields=[
         DataGrid.Column('name', options=dict(foobar=123)),
         ('Subtype', 'subtype'),
         DataGrid.Column('text', 'excerpt', 'TEXT')])
     d = dict(value='value')
     grid.update_params(d)
     get_field = d['get_field']
     assert d['columns'][0].get_option('foobar') == 123
     assert grid.get_column('name').options['foobar'] == 123
     row = Foo('spa1', 'fact', 'thetext')
     assert 'spa1' == get_field(row, 'name')
     assert 'fact' == get_field(row, 'column-1')
     assert 'thetext...' == get_field(row, 'text')
Exemplo n.º 2
0
 def test_column_declaration(self):
     """Test standard column declaration styles."""
     grid = DataGrid(name='grid',
                     fields=[
                         DataGrid.Column('name', options=dict(foobar=123)),
                         ('Subtype', 'subtype'),
                         DataGrid.Column('text', 'excerpt', 'TEXT')
                     ])
     d = dict(value='value')
     grid.update_params(d)
     get_field = d['get_field']
     # 'headers' and 'collist' only supported for backward compatibility
     assert d['headers'] == ['Name', 'Subtype', 'TEXT']
     assert d['collist'] == ['name', 'column-1', 'text']
     assert d['columns'][0].get_option('foobar') == 123
     assert grid.get_column('name').options['foobar'] == 123
     row = Foo('spa1', 'fact', 'thetext')
     assert 'spa1' == get_field(row, 'name')
     assert 'fact' == get_field(row, 'column-1')
     assert 'thetext...' == get_field(row, 'text')