def test_listWorksheet(): presModel = utils.getPresModelVizData(data) worksheets = utils.listWorksheet(presModel) assert len(worksheets) == 2 assert worksheets[0] == "[WORKSHEET1]" assert worksheets[1] == "[WORKSHEET2]" pytest.raises(KeyError, utils.listWorksheet, {}) pytest.raises(KeyError, utils.listWorksheet, emptyData) pytest.raises(KeyError, utils.listWorksheet, WithoutViz) pytest.raises(KeyError, utils.listWorksheet, WithoutPres1) pytest.raises(KeyError, utils.listWorksheet, WithoutMapPresModel) pytest.raises(KeyError, utils.listWorksheet, WithoutMapPres2)
def getWorksheets(TS, data, info) -> TableauDashboard: presModelMapVizData = utils.getPresModelVizData(data) presModelMapVizInfo = utils.getPresModelVizInfo(info) if presModelMapVizData is not None: worksheets = utils.listWorksheet(presModelMapVizData) elif presModelMapVizInfo is not None: worksheets = utils.listWorksheetInfo(presModelMapVizInfo) else: worksheets = [] output = [] for worksheet in worksheets: df = getWorksheet(TS, data, info, worksheet) output.append(df) return TableauDashboard(scraper=TS, originalData=data, originalInfo=info, data=output)