Пример #1
0
 def test_add_one_bad_type(self):
     """Raise a TypeError given non-Index data."""
     wb = Workbook()
     ws = wb.active
     iws = IndexesWorksheet(ws)
     iws.setup()
     with pytest.raises(TypeError):
         iws.add_one('Frogs!')
Пример #2
0
 def test_add_one(self):
     """Add a single Index to worksheet."""
     messages = StringIO()
     wb = Workbook()
     ws = wb.active
     iws = IndexesWorksheet(ws)
     iws.setup()
     idx = Index(name='Perennial', description='Built to last.')
     iws.add_one(idx, stream=messages)
     assert iws.cell(2, iws.cols['Index']).value == 'Perennial'
     assert iws.cell(
         2, iws.cols['Description']
     ).value == 'Built to last.'
     messages.seek(0)
     msgs = messages.read()
     assert ('Adding data from <Index "Perennial"> to row #2 of indexes '
             'worksheet.') in msgs