def test_show_retrieve_by_id(show_id: int): """Testing for :py:meth:`wwdtm.show.Show.retrieve_by_id` :param show_id: Show ID to test retrieving show information """ show = Show(connect_dict=get_connect_dict()) info = show.retrieve_by_id(show_id) assert info, f"Show ID {show_id} not found" assert "date" in info, f"'date' was not returned for ID {show_id}"
def perf_test_show(connect_dict: Dict[str, Any]) -> float: """Run performance test for the wwdtm.show module :param connect_dict: A dictionary containing database connection settings for use by mysql.connector :type connect_dict: Dict[str, Any] :return: Duration of the performance test :rtype: float """ show = Show(connect_dict=connect_dict) # Performance run start time start_time = time.perf_counter() _ = show.retrieve_all() _ = show.retrieve_all_details() _ = show.retrieve_all_dates() _ = show.retrieve_all_dates_tuple() _ = show.retrieve_all_ids() _ = show.retrieve_all_show_years_months() _ = show.retrieve_all_shows_years_months_tuple() for i in range(3): _ = show.retrieve_by_date(year=2018, month=10, day=27) _ = show.retrieve_by_date(year=2006, month=8, day=19) for i in range(3): _ = show.retrieve_by_date_string(date_string="2018-10-27") _ = show.retrieve_by_date_string(date_string="2006-08-19") for i in range(3): _ = show.retrieve_by_id(show_id=1083) _ = show.retrieve_by_id(show_id=47) for i in range(3): _ = show.retrieve_by_year(year=2018) _ = show.retrieve_by_year(year=2006) for i in range(3): _ = show.retrieve_by_year_month(year=2018, month=10) _ = show.retrieve_by_year_month(year=2006, month=8) for i in range(3): _ = show.retrieve_details_by_date(year=2018, month=10, day=27) _ = show.retrieve_details_by_date(year=2006, month=8, day=19) for i in range(3): _ = show.retrieve_details_by_date_string(date_string="2018-10-27") _ = show.retrieve_details_by_date_string(date_string="2006-08-19") for i in range(3): _ = show.retrieve_details_by_id(show_id=1083) _ = show.retrieve_details_by_id(show_id=47) for i in range(3): _ = show.retrieve_details_by_year(year=2018) _ = show.retrieve_details_by_year(year=2006) for i in range(3): _ = show.retrieve_details_by_year_month(year=2018, month=10) _ = show.retrieve_details_by_year_month(year=2018, month=10) _ = show.retrieve_recent() _ = show.retrieve_recent_details() # Performance run end time end_time = time.perf_counter() return round(end_time - start_time, 5)