Skip to content

Commit

Permalink
deduplicate test
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed Oct 7, 2024
1 parent 08bfc01 commit 4c5fc56
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tests/mixins/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ def test_search_exceptions(self, yt_auth):
yt_auth.search(query, scope="upload")

@pytest.mark.parametrize("query", ["Monekes", "llwlwl", "heun"])
def test_search_queries(self, yt, yt_brand, query: str) -> None:
results = yt_brand.search(query)
@pytest.mark.parametrize("yt_instance", ["yt", "yt_brand"])
def test_search_queries(self, query: str, yt_instance: str, request: pytest.FixtureRequest) -> None:
yt: YTMusic = request.getfixturevalue(yt_instance)
results = yt.search(query)
assert all(album["playlistId"] is not None for album in results if album["resultType"] == "album")
assert ["resultType" in r for r in results] == [True] * len(results)
assert len(results) >= 5
Expand All @@ -24,14 +26,6 @@ def test_search_queries(self, yt, yt_brand, query: str) -> None:
if "artists" in result
for artist in result["artists"]
)
results = yt.search(query)
assert len(results) >= 5
assert not any(
artist["name"].lower() in ALL_RESULT_TYPES
for result in results
if "artists" in result
for artist in result["artists"]
)

def test_search_ignore_spelling(self, yt_auth):
results = yt_auth.search("Martin Stig Andersen - Deteriation", ignore_spelling=True)
Expand Down

0 comments on commit 4c5fc56

Please sign in to comment.