def test_declarations():
 class GeoAreaTable(tables.Table, ):
  name = tables.Column()
  population = tables.Column()
 assert (len(GeoAreaTable.base_columns) == 2)
 assert (u'name' in GeoAreaTable.base_columns)
 assert (not hasattr(GeoAreaTable, u'name'))
 class CountryTable(GeoAreaTable, ):
  capital = tables.Column()
 assert (len(CountryTable.base_columns) == 3)
 assert (u'capital' in CountryTable.base_columns)
 class AddedMixin(tables.Table, ):
  added = tables.Column()
 class CityTable(GeoAreaTable, AddedMixin, ):
  mayor = tables.Column()
 assert (len(CityTable.base_columns) == 4)
 assert (u'added' in CityTable.base_columns)
 class MayorlessCityTable(CityTable, ):
  mayor = None
 assert (len(MayorlessCityTable.base_columns) == 3)

def test_declarations ( ) : class GeoAreaTable ( tables . Table , ) : name = tables . Column ( ) population = tables . Column ( ) assert ( len ( GeoAreaTable . base_columns ) == 2 ) assert ( u'name' in GeoAreaTable . base_columns ) assert ( not hasattr ( GeoAreaTable , u'name' ) ) class CountryTable ( GeoAreaTable , ) : capital = tables . Column ( ) assert ( len ( CountryTable . base_columns ) == 3 ) assert ( u'capital' in CountryTable . base_columns ) class AddedMixin ( tables . Table , ) : added = tables . Column ( ) class CityTable ( GeoAreaTable , AddedMixin , ) : mayor = tables . Column ( ) assert ( len ( CityTable . base_columns ) == 4 ) assert ( u'added' in CityTable . base_columns ) class MayorlessCityTable ( CityTable , ) : mayor = None assert ( len ( MayorlessCityTable . base_columns ) == 3 )
test defining tables by declaration .