コード例 #1
0
def test_show_retrieve_all_show_years_months_tuple():
    """Testing for :py:meth:`wwdtm.show.Show.retrieve_all_shows_years_months_tuple`"""
    show = Show(connect_dict=get_connect_dict())
    dates = show.retrieve_all_shows_years_months_tuple()

    assert dates, "No dates could be retrieved"
    assert isinstance(dates[0], tuple), "First list item is not a tuple"
コード例 #2
0
ファイル: perf_test.py プロジェクト: questionlp/wwdtm
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)