From 42c2f73da81133d509fb3913fa25f5550bda2ea6 Mon Sep 17 00:00:00 2001 From: Hellow2 Date: Tue, 28 Mar 2023 11:34:45 +0200 Subject: [PATCH] added tests and fixed a bug --- src/music_kraken/objects/song.py | 2 +- ...lding_objects.py => test_building_objects.py} | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) rename src/tests/{building_objects.py => test_building_objects.py} (84%) diff --git a/src/music_kraken/objects/song.py b/src/music_kraken/objects/song.py index d599576..1f2464d 100644 --- a/src/music_kraken/objects/song.py +++ b/src/music_kraken/objects/song.py @@ -113,7 +113,7 @@ class Song(MainObject): for artist in self.main_artist_collection: for album in self.album_collection: - artist.main_album_collection.append(self, merge_on_conflict=merge, merge_into_existing=False) + artist.main_album_collection.append(album, merge_on_conflict=merge, merge_into_existing=False) artist._build_recursive_structures(build_version=build_version, merge=merge) @property diff --git a/src/tests/building_objects.py b/src/tests/test_building_objects.py similarity index 84% rename from src/tests/building_objects.py rename to src/tests/test_building_objects.py index 46bb7bb..10456ae 100644 --- a/src/tests/building_objects.py +++ b/src/tests/test_building_objects.py @@ -35,7 +35,7 @@ class TestSong(unittest.TestCase): self.artist_list = [] - main_artist_list=[ + self.main_artist_list=[ objects.Artist( name="I'm in a coffin", source_list=[ @@ -56,7 +56,7 @@ class TestSong(unittest.TestCase): ) ] - self.artist_list.extend(main_artist_list) + self.artist_list.extend(self.main_artist_list) self.artist_list.extend(feature_artist_list) self.song = objects.Song( @@ -81,13 +81,19 @@ class TestSong(unittest.TestCase): "https://ln.topdf.de/Music-Kraken/") ], album_list=self.album_list, - main_artist_list=main_artist_list, + main_artist_list=self.main_artist_list, feature_artist_list=feature_artist_list, ) + + self.song.compile() def test_album(self): - pass + for artist in self.song.main_artist_collection: + for artist_album in artist.main_album_collection: + self.assertIn(artist_album, self.song.album_collection) def test_artist(self): - pass + for album in self.song.album_collection: + for album_artist in album.artist_collection: + self.assertIn(album_artist, self.song.main_artist_collection)