added tests and fixed a bug

This commit is contained in:
Hellow2 2023-03-28 11:34:45 +02:00
parent 63a3dc00fd
commit 42c2f73da8
2 changed files with 12 additions and 6 deletions

View File

@ -113,7 +113,7 @@ class Song(MainObject):
for artist in self.main_artist_collection: for artist in self.main_artist_collection:
for album in self.album_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) artist._build_recursive_structures(build_version=build_version, merge=merge)
@property @property

View File

@ -35,7 +35,7 @@ class TestSong(unittest.TestCase):
self.artist_list = [] self.artist_list = []
main_artist_list=[ self.main_artist_list=[
objects.Artist( objects.Artist(
name="I'm in a coffin", name="I'm in a coffin",
source_list=[ 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.artist_list.extend(feature_artist_list)
self.song = objects.Song( self.song = objects.Song(
@ -81,13 +81,19 @@ class TestSong(unittest.TestCase):
"https://ln.topdf.de/Music-Kraken/") "https://ln.topdf.de/Music-Kraken/")
], ],
album_list=self.album_list, album_list=self.album_list,
main_artist_list=main_artist_list, main_artist_list=self.main_artist_list,
feature_artist_list=feature_artist_list, feature_artist_list=feature_artist_list,
) )
self.song.compile()
def test_album(self): 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): 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)