def test_show_retrieve_recent_details(): """Testing for :py:meth:`wwdtm.show.Show.retrieve_recent_details`""" show = Show(connect_dict=get_connect_dict()) shows = show.retrieve_recent_details() assert shows, "No shows could be retrieved" assert "date" in shows[ 0], "'date' was not returned for the first list item" assert "host" in shows[0], "'host' was not returned for first list item"
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)