Skip to content

Commit

Permalink
Add a regression test for issue pylint-dev#4631
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Jun 30, 2021
1 parent 52027cb commit f1d19b7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/functional/r/regression/regression_issue_4631.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
Regression tests for StopIteration raised when using limit-inference-results=0
"""

import typing

from ytmusicapi import YTMusic


def get_youtube_link(
song_name: str, song_artists: typing.List[str]
) -> typing.Optional[str]:
ytm_results = __query_ytmusic(song_name=song_name, song_artists=song_artists)
top_match_score = 0
top_result = None
if top_match_score <= 0.75:
if top_result is not None:
with open("possible errors.txt", "ab") as file:
file.write(
f"{', '.join(song_artists)} - {song_name}\n {top_match_score:0.2f}pt "
f"{top_result['link']}: {top_result['name']}\n".encode()
)
2 changes: 2 additions & 0 deletions tests/functional/r/regression/regression_issue_4631.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[testoptions]
limit-inference-results=0

0 comments on commit f1d19b7

Please sign in to comment.