8000 Add inclusive named parameter to Best Of and Repeats show methods by questionlp · Pull Request #91 · questionlp/wwdtm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Add inclusive named parameter to Best Of and Repeats show methods #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
Changes
*******

2.18.2
======

Application Changes
-------------------

* Add `inclusive` named parameter to the following methods to determine whether repeat shows are included with Best Of shows, or whether Best Of shows included with repeat shows. Default value in all cases is ``True``.

* :py:meth:`wwdtm.show.Show.retrieve_all_best_ofs`
* :py:meth:`wwdtm.show.Show.retrieve_all_best_ofs_details`
* :py:meth:`wwdtm.show.Show.retrieve_all_repeats`
* :py:meth:`wwdtm.show.Show.retrieve_all_repeats_details`
* :py:meth:`wwdtm.show.Show.retrieve_best_ofs_by_year`
* :py:meth:`wwdtm.show.Show.retrieve_best_ofs_details_by_year`
* :py:meth:`wwdtm.show.Show.retrieve_repeats_by_year`
* :py:meth:`wwdtm.show.Show.retrieve_repeats_details_by_year`

2.18.1
======

Expand Down
127 changes: 103 additions & 24 deletions tests/show/test_show_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,37 @@ def test_show_retrieve_all():
assert "id" in shows[0], "No Show ID returned for the first list item"


def test_show_retrieve_all_best_ofs():
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_all_best_ofs`."""
@pytest.mark.parametrize("inclusive", [True, False])
def test_show_retrieve_all_best_ofs(inclusive: bool):
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_all_best_ofs`.

:param inclusive: Include Repeat shows in the list of Best Of
shows
"""
show = Show(connect_dict=get_connect_dict())
shows = show.retrieve_all_best_ofs()
shows = show.retrieve_all_best_ofs(inclusive=inclusive)

assert shows, "No shows could be retrieved"
assert "id" in shows[0], "No Show ID returned for the first list item"


@pytest.mark.parametrize("include_decimal_scores", [True, False])
def test_show_retrieve_all_best_ofs_details(include_decimal_scores: bool):
@pytest.mark.parametrize(
"inclusive, include_decimal_scores",
[(True, True), (True, False 10000 ), (False, True), (False, False)],
)
def test_show_retrieve_all_best_ofs_details(
inclusive: bool, include_decimal_scores: bool
):
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_all_best_ofs_details`.

:param inclusive: Include Repeat shows in the list of Best Of
shows
:param include_decimal_scores: Flag set to include decimal score columns
and values
"""
show = Show(connect_dict=get_connect_dict())
shows = show.retrieve_all_best_ofs_details(
include_decimal_scores=include_decimal_scores
inclusive=inclusive, include_decimal_scores=include_decimal_scores
)

assert shows, "No shows could be retrieved"
Expand Down Expand Up @@ -129,25 +141,37 @@ def test_show_retrieve_all_dates_tuple():
assert isinstance(dates[0], tuple), "First list item is not a tuple"


def test_show_retrieve_all_repeats():
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_all_repeats`."""
@pytest.mark.parametrize("inclusive", [True, False])
def test_show_retrieve_all_repeats(inclusive: bool):
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_all_repeats`.

:param inclusive: Include Best Of shows in the list of repeat
shows
"""
show = Show(connect_dict=get_connect_dict())
shows = show.retrieve_all_repeats()
shows = show.retrieve_all_repeats(inclusive=inclusive)

assert shows, "No shows could be retrieved"
assert "id" in shows[0], "No Show ID returned for the first list item"


@pytest.mark.parametrize("include_decimal_scores", [True, False])
def test_show_retrieve_all_repeat_details(include_decimal_scores: bool):
@pytest.mark.parametrize(
"inclusive, include_decimal_scores",
[(True, True), (True, False), (False, True), (False, False)],
)
def test_show_retrieve_all_repeat_details(
inclusive: bool, include_decimal_scores: bool
):
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_all_repeat_details`.

:param inclusive: Include Best Of shows in the list of repeat
shows
:param include_decimal_scores: Flag set to include decimal score columns
and values
"""
show = Show(connect_dict=get_connect_dict())
shows = show.retrieve_all_repeats_details(
include_decimal_scores=include_decimal_scores
inclusive=inclusive, include_decimal_scores=include_decimal_scores
)

assert shows, "No shows could be retrieved"
Expand Down Expand Up @@ -199,14 +223,18 @@ def test_show_retrieve_all_show_years_months_tuple():
assert isinstance(dates[0], tuple), "First list item is not a tuple"


@pytest.mark.parametrize("year", [1998, 2008])
def test_show_retrieve_best_ofs_by_year(year: int):
@pytest.mark.parametrize(
"year, inclusive", [(1998, True), (1998, False), (2008, True), (2008, False)]
)
def test_show_retrieve_best_ofs_by_year(year: int, inclusive: bool):
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_best_ofs_by_year`.

:param year: Four digit year to test retrieving show information
:param inclusive: Include Repeat shows in the list of Best Of
shows
"""
show = Show(connect_dict=get_connect_dict())
shows = show.retrieve_best_ofs_by_year(year=year)
shows = show.retrieve_best_ofs_by_year(year=year, inclusive=inclusive)

assert shows, f"Information for Best Of Shows for year {year:04d} not found"
assert "id" in shows[0], "'id' was not returned for the first list item"
Expand All @@ -215,14 +243,35 @@ def test_show_retrieve_best_ofs_by_year(year: int):
assert shows[0]["best_of"], "'best_of' value for the first list item is not valid"


@pytest.mark.parametrize("year", [1998, 2008])
def test_show_retrieve_best_ofs_details_by_year(year: int):
@pytest.mark.parametrize(
"year, inclusive, include_decimal_scores",
[
(1998, True, True),
(1998, True, False),
(1998, False, True),
(1998, False, False),
(2008, True, True),
(2008, True, False),
(2008, False, True),
(2008, False, False),
],
)
def test_show_retrieve_best_ofs_details_by_year(
year: int, inclusive: bool, include_decimal_scores: bool
):
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_best_ofs_details_by_year`.

:param year: Four digit year to test retrieving show information
:param inclusive: Include Repeat shows in the list of Best Of
shows
:param include_decimal_scores: Flag set to include decimal score
columns and values

"""
show = Show(connect_dict=get_connect_dict())
shows = show.retrieve_best_ofs_details_by_year(year=year)
shows = show.retrieve_best_ofs_details_by_year(
year=year, inclusive=inclusive, include_decimal_scores=include_decimal_scores
)

assert shows, f"Information for Best Of Shows for year {year:04d} not found"
assert "id" in shows[0], "'id' was not returned for the first list item"
Expand Down Expand Up @@ -640,14 +689,24 @@ def test_show_retrieve_repeat_best_ofs_details_by_year(year: int):
)


@pytest.mark.parametrize("year", [2000, 2010])
def test_show_retrieve_repeats_by_year(year: int):
@pytest.mark.parametrize(
"year, inclusive",
[
(2000, True),
(2000, False),
(2010, True),
(2010, False),
],
)
def test_show_retrieve_repeats_by_year(year: int, inclusive: bool):
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_best_ofs_by_year`.

:param year: Four digit year to test retrieving show information
:param inclusive: Include Best Of shows in the list of repeat
shows
"""
show = Show(connect_dict=get_connect_dict())
shows = show.retrieve_repeats_by_year(year=year)
shows = show.retrieve_repeats_by_year(year=year, inclusive=inclusive)

assert shows, f"Information for Best Of Shows for year {year:04d} not found"
assert "id" in shows[0], "'id' was not returned for the first list item"
Expand All @@ -660,14 +719,34 @@ def test_show_retrieve_repeats_by_year(year: int):
)


@pytest.mark.parametrize("year", [2000, 2010])
def test_show_retrieve_repeats_details_by_year(year: int):
@pytest.mark.parametrize(
"year, inclusive, include_decimal_scores",
[
(2000, True, True),
(2000, True, False),
(2000, False, True),
(2000, False, False),
(2010, True, True),
(2010, True, False),
(2010, False, True),
(2010, False, False),
],
)
def test_show_retrieve_repeats_details_by_year(
year: int, inclusive: bool, include_decimal_scores: bool
):
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_best_ofs_details_by_year`.

:param year: Four digit year to test retrieving show information
:param inclusive: Include Best Of shows in the list of repeat
shows
:param include_decimal_scores: Flag set to include decimal score
columns and values
"""
show = Show(connect_dict=get_connect_dict())
shows = show.retrieve_repeats_details_by_year(year=year)
shows = show.retrieve_repeats_details_by_year(
year=year, inclusive=inclusive, include_decimal_scores=include_decimal_scores
)

assert shows, f"Information for Best Of Shows for year {year:04d} not found"
assert "id" in shows[0], "'id' was not returned for the first list item"
Expand Down
2 changes: 1 addition & 1 deletion wwdtm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from wwdtm.scorekeeper import Scorekeeper, ScorekeeperAppearances, ScorekeeperUtility
from wwdtm.show import Show, ShowInfo, ShowInfoMultiple, ShowUtility

VERSION = "2.18.1"
VERSION = "2.18.2"


def database_version(
Expand Down
Loading
0