示例#1
0
 def test_populate_cols_dict_no_titles(self):
     """Raise a ValueError if there is no data in the first row."""
     wb = Workbook()
     ws = wb.active
     sws = SeedsWorksheet(ws)
     with pytest.raises(ValueError):
         sws.populate_cols_dict()
示例#2
0
 def test_populate_cols_dict(self):
     """Set cols keys to values in first row, and vals to col numbers."""
     wb = Workbook()
     ws = wb.active
     sws = SeedsWorksheet(ws)
     titles = ['One', 'Two', 'Three', 'Four']
     sws.set_column_titles(titles)
     sws.populate_cols_dict()
     assert sws.cols['One'] == 1
     assert sws.cols['Two'] == 2
     assert sws.cols['Three'] == 3
     assert sws.cols['Four'] == 4