コード例 #1
0
ファイル: test_excel.py プロジェクト: TheLetterN/sgs-flask
 def test_add_one_with_optionals(self):
     """Add a common name with optionals to Common Names sheet."""
     wb = Workbook()
     ws = wb.active
     cnws = CommonNamesWorksheet(ws)
     cnws.setup()
     cn = CommonName(name='Foxglove',
                     description='Spotty.',
                     instructions='Just add water!')
     cn.index = Index(name='Perennial')
     cn.synonyms_string = 'Digitalis'
     cnws.add_one(cn)
     assert cnws.cell(2, cnws.cols['Description']).value == 'Spotty.'
     assert cnws.cell(
         2, cnws.cols['Planting Instructions']
     ).value == 'Just add water!'
     assert cnws.cell(2, cnws.cols['Synonyms']).value == 'Digitalis'
コード例 #2
0
ファイル: test_excel.py プロジェクト: TheLetterN/sgs-flask
 def test_add_one_no_optionals(self):
     """Add a common name (with no optional data) to Common Names sheet."""
     messages = StringIO()
     wb = Workbook()
     ws = wb.active
     cnws = CommonNamesWorksheet(ws)
     cnws.setup()
     cn = CommonName(name='Foxglove')
     cn.index = Index(name='Perennial')
     cnws.add_one(cn, stream=messages)
     assert cnws.cell(2, cnws.cols['Index']).value == 'Perennial'
     assert cnws.cell(2, cnws.cols['Common Name']).value == 'Foxglove'
     assert cnws.cell(2, cnws.cols['Description']).value is None
     assert cnws.cell(2, cnws.cols['Planting Instructions']).value is None
     assert cnws.cell(2, cnws.cols['Synonyms']).value is None
     messages.seek(0)
     msgs = messages.read()
     assert ('Adding data from <CommonName "Foxglove"> to row #2 of '
             'common names worksheet.') in msgs