def test_setup_new_no_titles(self): """Raise a value error if _setup is run without titles on new sheet.""" wb = Workbook() ws = wb.active sws = SeedsWorksheet(ws) with pytest.raises(ValueError): sws._setup()
def test_setup_existing(self, m_pcd, m_sct): """Do not call set_column_titles if data in first row already.""" wb = Workbook() ws = wb.active sws = SeedsWorksheet(ws) sws._ws['A1'].value = 'One' sws._setup() assert m_pcd.called assert not m_sct.called
def test_setup_new(self, m_pcd, m_sct): """Call set_column_titles and populate_cols_dict when sheet blank.""" wb = Workbook() ws = wb.active sws = SeedsWorksheet(ws) titles = ('One', 'Two', 'Three') sws._setup(titles) assert m_pcd.called assert m_sct.called_with(titles)
def test_setup_existing_with_titles(self, m_pcd, m_sct): """Set up as normal but discard new titles.""" wb = Workbook() ws = wb.active sws = SeedsWorksheet(ws) sws._ws['A1'].value = 'One' titles = ('One', 'Two', 'Three') with pytest.warns(UserWarning): sws._setup(titles) assert m_pcd.called assert not m_sct.called