def test_write_file(): path = os.path.abspath(__file__) for _ in range(4): path = os.path.dirname(path) data = va_data_source.DataSource(event=test_event_name, season=test_season) fpath = path + test_file_name data.write_file(fpath) file_data = va_data_source.DataSource(fpath) os.remove(fpath) assert isinstance(file_data, va_data_source.DataSource) assert file_data.event == test_event_name assert file_data.season == test_season assert not file_data.from_sql assert isinstance(file_data.status, pd.DataFrame)
def test_write_vif(): path = os.path.abspath(__file__) for _ in range(4): path = os.path.dirname(path) data = va_data_source.DataSource(event=test_event_name, season=test_season) fpath = path + r'\vif.pickle' data.write_file(fpath)
def test_multiselect(): data = va_data_source.DataSource(event=test_event_name, season=test_season) assert isinstance(data.enum_tasks, list) assert len(data.enum_tasks) > 7 assert 'launchLower' in data.enum_tasks oneteam = va_oneteam.OneTeam(data) layout = oneteam.layout_1t('2046', ['launchLower'])
def test_oneteam(): data = va_data_source.DataSource(event='test_event_2', season='2020') oneteam = va_oneteam.OneTeam(data) assert isinstance(oneteam.data.measures, pd.DataFrame) assert isinstance(oneteam.data.schedule, pd.DataFrame) assert oneteam.data.measures.shape[1] == 20 assert len(oneteam.list_teams()) > 15 plot = oneteam.plot_1t('1318') assert isinstance(oneteam.df_new_1t('1318'), pd.DataFrame)
def test_data_source(): data = va_data_source.DataSource(event=test_event_name, season=test_season) assert isinstance(data, va_data_source.DataSource) assert isinstance(data.measures, pd.DataFrame) assert data.measures.shape[0] > 1000 assert data.measures.shape[1] == 20 assert isinstance(data.schedule, pd.DataFrame) assert isinstance(data.teams, pd.DataFrame) assert data.teams.shape[1] == 8 assert data.teams.shape[0] > 20 assert data.event == test_event_name assert data.season == test_season
def test_rankingtable(): data_source = va_data_source.DataSource(event='test_event_2', season='2020') rt = rankingtable.rankingTable(data_source) rt.panel()
import pandas as pd import viewer_app.sixteam as svv import server.model.event as sme import viewer_app.data_source as va_data_source data_source = va_data_source.DataSource(event='wasno', season='2020') def test_viewer(): viewer = svv.SixTeam(data_source) evt = sme.EventDal.get_current_event() assert evt[1] == 'wasno' assert evt[2] == '2020' assert viewer.measures.shape[0] > 1000 assert viewer.measures.shape[1] == 20 assert isinstance(viewer.schedule, pd.DataFrame) assert isinstance(viewer.teams, pd.DataFrame) matches = viewer.list_matches() assert len(matches) > 10 assert matches[0] == '001-q'
import viewer_app.data_source as va_data_source import viewer_app.sixteam as va_sixteam import viewer_app.rankingtable as va_rankingtable import viewer_app.pointschart as va_pointschart import viewer_app.oneteam as va_oneteam import viewer_app.file_management as va_fm # if len(sys.argv) >= 2: # if sys.argv[1] == 'sql': # data_source = va_data_source.DataSource(event='test_event_2', # season='2020') # else: # data_source = va_data_source.DataSource(fname='vif.pickle') if sys.argv[1] == 'sql': data_source = va_data_source.DataSource(event='wasno', season='2020') else: data_source = va_data_source.DataSource(fname= 'vif.pickle') #data_source = va_data_source.DataSource(event='wasno', season='2020') panels = [] file_manager = va_fm.DataFile(data_source) panels.append(file_manager.panel_file_management()) # sixteam = va_sixteam.SixTeam(data_source) # panels.append(sixteam.panel('001-q')) oneteam_tasks = ['launchOuter', 'climbPosition'] oneteam = va_oneteam.OneTeam(data_source)
def test_num_teams(): data = va_data_source.DataSource(event=test_event_name, season=test_season) print() print(data.teams)
def test_enum_measures(): data = va_data_source.DataSource(event=test_event_name, season=test_season) enum_meas = data._enum_preprocess()
def test_panel(): data = va_data_source.DataSource(event=test_event_name, season=test_season) oneteam = va_oneteam.OneTeam(data) panel = oneteam.panel_1t('1318', ['launchOuter', 'climbPosition'])
import bokeh.plotting as bk_plt import bokeh.models as bk_models import viewer_app.data_source as va_data_source import viewer_app.sixteam as va_sixteam import viewer_app.oneteam as va_oneteam data_source = va_data_source.DataSource(event='test_event_2', season='2020') panels = [] sixteam = va_sixteam.SixTeam(data_source) panels.append(sixteam.panel('001-q')) oneteam_tasks = ['shootUpper', 'climbPosition'] oneteam = va_oneteam.OneTeam(data_source) panels.append(oneteam.panel_1t('1318', ['shootUpper', 'shootLower'])) tabs = bk_models.Tabs(tabs=panels) bk_plt.curdoc().add_root(tabs)
def test_file_manage(): file = va_fm.DataFile() ds = va_data_source.DataSource() ds.write_file(fname='test_pickle') ds = va_data_source.DataSource('test_pickle')
def test_sixteam(): data = va_data_source.DataSource(event='wasno', season='2020') sixteam = va_sixteam.SixTeam(data) print(sixteam.data.schedule) # plot = sixteam.total_1t('1318', ['noShow']) print(sixteam.df_new_6t('red', '010-q'))
def test_noshow(): data = va_data_source.DataSource(event='test_event_2', season='2020') oneteam = va_oneteam.OneTeam(data) plot = oneteam.total_1t('1318', ['noShow'])