From 079994c003e8ba33305f47ede3d2aaa7de30c765 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Wed, 20 Jul 2022 22:41:42 -0700 Subject: [PATCH] [BUGFIX] Remove description from Soundcloud source variables (#114) * [BUGFIX] Remove description from Soundcloud source variable * update unit tests --- src/ytdl_sub/entries/variables/entry_variables.py | 9 --------- src/ytdl_sub/entries/variables/youtube_variables.py | 9 +++++++++ tests/unit/entries/conftest.py | 12 +----------- tests/unit/entries/test_youtube_entries.py | 7 +++++++ 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/ytdl_sub/entries/variables/entry_variables.py b/src/ytdl_sub/entries/variables/entry_variables.py index 4e75d443..69c0fa26 100644 --- a/src/ytdl_sub/entries/variables/entry_variables.py +++ b/src/ytdl_sub/entries/variables/entry_variables.py @@ -177,12 +177,3 @@ class EntryVariables(SourceVariables): The uploaded date formatted as YYYY-MM-DD """ return f"{self.upload_year}-{self.upload_month_padded}-{self.upload_day_padded}" - - @property - def description(self: BaseEntry) -> str: - """ - Returns - ------- - The description of the entry. - """ - return self.kwargs("description") diff --git a/src/ytdl_sub/entries/variables/youtube_variables.py b/src/ytdl_sub/entries/variables/youtube_variables.py index 4ea0aa57..83da35b6 100644 --- a/src/ytdl_sub/entries/variables/youtube_variables.py +++ b/src/ytdl_sub/entries/variables/youtube_variables.py @@ -91,3 +91,12 @@ class YoutubeVideoVariables(EntryVariables): The size of the playlist. For non-playlist download strategies, this will always return 1. """ return 1 + + @property + def description(self: BaseEntry) -> str: + """ + Returns + ------- + The description of the entry. + """ + return self.kwargs("description") diff --git a/tests/unit/entries/conftest.py b/tests/unit/entries/conftest.py index 101aa81f..2e625eeb 100644 --- a/tests/unit/entries/conftest.py +++ b/tests/unit/entries/conftest.py @@ -25,11 +25,6 @@ def title(): return "entry title" -@pytest.fixture -def description(): - return "a description" - - @pytest.fixture def upload_year(): return 2021 @@ -79,7 +74,6 @@ def mock_entry_to_dict( upload_date, upload_year, thumbnail_ext, - description, upload_month, upload_day, ): @@ -98,14 +92,11 @@ def mock_entry_to_dict( "upload_day": upload_day, "upload_day_padded": _pad(upload_day), "thumbnail_ext": thumbnail_ext, - "description": description, } @pytest.fixture -def mock_entry_kwargs( - uid, title, ext, upload_date, extractor, description, download_thumbnail_name -): +def mock_entry_kwargs(uid, title, ext, upload_date, extractor, download_thumbnail_name): return { "id": uid, "extractor": extractor, @@ -113,7 +104,6 @@ def mock_entry_kwargs( "ext": ext, "upload_date": upload_date, "thumbnail": download_thumbnail_name, - "description": description, } diff --git a/tests/unit/entries/test_youtube_entries.py b/tests/unit/entries/test_youtube_entries.py index 67f7ea79..6dfcb8a9 100644 --- a/tests/unit/entries/test_youtube_entries.py +++ b/tests/unit/entries/test_youtube_entries.py @@ -4,6 +4,11 @@ from ytdl_sub.entries.soundcloud import SoundcloudTrack from ytdl_sub.entries.youtube import YoutubeVideo +@pytest.fixture +def description(): + return "a description" + + @pytest.fixture def playlist_index(): return 1 @@ -44,6 +49,7 @@ def mock_youtube_video_to_dict( "track_title_sanitized": track_title, "artist": artist, "artist_sanitized": artist, + "description": description, } ) @@ -60,6 +66,7 @@ def mock_youtube_video_kwargs( "channel": channel, "track": track_title, "artist": artist, + "description": description, } )