diff --git a/.gitignore b/.gitignore index 318a0ce8..210086e0 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ build dist .pdm-python .venv +*.log +*.xml diff --git a/tests/__init__.py b/tests/__init__.py index 4f3ce510..e69de29b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,15 +0,0 @@ -from importlib.metadata import PackageNotFoundError, version - -from ytmusicapi.setup import setup, setup_oauth -from ytmusicapi.ytmusic import YTMusic - -try: - __version__ = version("ytmusicapi") -except PackageNotFoundError: - # package is not installed - pass - -__copyright__ = "Copyright 2023 sigma67" -__license__ = "MIT" -__title__ = "ytmusicapi" -__all__ = ["YTMusic", "setup_oauth", "setup"] diff --git a/tests/mixins/test_browsing.py b/tests/mixins/test_browsing.py index fc8677f8..f626d50c 100644 --- a/tests/mixins/test_browsing.py +++ b/tests/mixins/test_browsing.py @@ -37,11 +37,15 @@ def test_get_user(self, yt): results = yt.get_user("UC44hbeRoCZVVMVg5z0FfIww") assert len(results) == 3 - def test_get_user_playlists(self, yt_auth): - results = yt_auth.get_user("UCPVhZsC2od1xjGhgEc2NEPQ") # Vevo playlists - results = yt_auth.get_user_playlists("UCPVhZsC2od1xjGhgEc2NEPQ", results["playlists"]["params"]) + def test_get_user_playlists(self, yt, yt_auth): + channel = "UCPVhZsC2od1xjGhgEc2NEPQ" # Vevo playlists + user = yt_auth.get_user(channel) + results = yt_auth.get_user_playlists(channel, user["playlists"]["params"]) assert len(results) > 100 + results_empty = yt.get_user_playlists(channel, user["playlists"]["params"]) + assert len(results_empty) == 0 + def test_get_album_browse_id(self, yt, sample_album): warnings.filterwarnings(action="ignore", category=DeprecationWarning) browse_id = yt.get_album_browse_id("OLAK5uy_nMr9h2VlS-2PULNz3M3XVXQj_P3C2bqaY") diff --git a/tests/mixins/test_search.py b/tests/mixins/test_search.py index 017af097..7750c851 100644 --- a/tests/mixins/test_search.py +++ b/tests/mixins/test_search.py @@ -2,11 +2,11 @@ class TestSearch: - def test_search_exceptions(self): + def test_search_exceptions(self, yt_auth): query = "edm playlist" - with pytest.raises(Exception): + with pytest.raises(Exception, match="Invalid filter provided"): yt_auth.search(query, filter="song") - with pytest.raises(Exception): + with pytest.raises(Exception, match="Invalid scope provided"): yt_auth.search(query, scope="upload") @pytest.mark.parametrize("query", ["Monekes", "qllwlwl", "heun"]) diff --git a/ytmusicapi/mixins/_protocol.py b/ytmusicapi/mixins/_protocol.py index 2983b5d0..40fe733d 100644 --- a/ytmusicapi/mixins/_protocol.py +++ b/ytmusicapi/mixins/_protocol.py @@ -17,14 +17,14 @@ class MixinProtocol(Protocol): proxies: Optional[Dict[str, str]] def _check_auth(self) -> None: - pass + """checks if self has authentication""" def _send_request(self, endpoint: str, body: Dict, additionalParams: str = "") -> Dict: - pass + """for sending post requests to YouTube Music""" def _send_get_request(self, url: str, params: Optional[Dict] = None) -> Response: - pass + """for sending get requests to YouTube Music""" @property def headers(self) -> Dict[str, str]: - pass + """property for getting request headers""" diff --git a/ytmusicapi/navigation.py b/ytmusicapi/navigation.py index e5c6d1ac..616add10 100644 --- a/ytmusicapi/navigation.py +++ b/ytmusicapi/navigation.py @@ -71,12 +71,12 @@ @overload def nav(root: Dict[str, Any], items: List[Any], none_if_absent: Literal[False] = False) -> Any: - ... + """overload for mypy only""" @overload def nav(root: Dict, items: List[Any], none_if_absent: Literal[True] = True) -> Optional[Any]: - ... + """overload for mypy only""" def nav(root: Dict, items: List[Any], none_if_absent: bool = False) -> Optional[Any]: