From 6d2a7469fcdb9259396f87d49271d26f4b1d8914 Mon Sep 17 00:00:00 2001 From: Hellow Date: Fri, 24 Mar 2023 19:07:37 +0100 Subject: [PATCH] modified diagram --- README.md | 18 +++++++++--------- src/tests/test_objects.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cdd7fee..a82d5ff 100644 --- a/README.md +++ b/README.md @@ -156,21 +156,21 @@ Source { } -Source }o--|| Song : from -Source }o--|| Lyrics : from -Source }o--|| Album : from -Source }o--|| Artist : from -Source }o--|| Label : from +Source }o--|| Song : "" +Source }o--|| Lyrics : "" +Source }o--|| Album : "" +Source }o--|| Artist : "" +Source }o--|| Label : "" Song }o--o{ Album : AlbumSong Album }o--o{ Artist : ArtistAlbum -Song }o--o{ Artist : features +Song }o--o{ Artist : "ArtistSong (features)" Label }o--o{ Album : LabelAlbum Label }o--o{ Artist : LabelSong -Song ||--o{ Lyrics : contains -Song ||--o{ Target : points +Song ||--o{ Lyrics : "" +Song ||--o{ Target : "" ``` Ok now this **WILL** look intimidating, thus I break it down quickly. @@ -216,7 +216,7 @@ Label { Song }o--o{ Album : AlbumSong Album }o--o{ Artist : ArtistAlbum -Song }o--o{ Artist : features +Song }o--o{ Artist : "ArtistSong (features)" Label }o--o{ Album : LabelAlbum Label }o--o{ Artist : LabelSong diff --git a/src/tests/test_objects.py b/src/tests/test_objects.py index 4f7ac7f..8e1a432 100644 --- a/src/tests/test_objects.py +++ b/src/tests/test_objects.py @@ -169,6 +169,42 @@ class TestCollection(unittest.TestCase): self.assertIn(song.unified_title, self.unified_titels) +class TestCollectionAppending(unittest.TestCase): + def setUp(self): + self.song_list: objects.song = [ + objects.Song(title="hasskrank"), + objects.Song(title="HaSSkrank"), + objects.Song(title="Suicideseason", isrc="uniqueID"), + objects.Song(title="same isrc different title", isrc="uniqueID") + ] + self.unified_titels = set(song.unified_title for song in self.song_list) + + def test_appending(self): + collection = objects.Collection( + element_type=objects.Song, + data=self.song_list + ) + + res = collection.append(self.song_list[0]) + self.assertEqual(res.was_in_collection, False) + self.assertEqual(res.current_element, self.song_list[0]) + + res = collection.append(self.song_list[1]) + self.assertEqual(res.was_in_collection, True) + self.assertEqual(res.current_element, self.song_list[0]) + + res = collection.append(self.song_list[2]) + self.assertEqual(res.was_in_collection, False) + self.assertEqual(res.current_element, self.song_list[2]) + + res = collection.append(self.song_list[3]) + self.assertEqual(res.was_in_collection, True) + self.assertEqual(res.current_element, self.song_list[2]) + + + + + class TestLyrics(unittest.TestCase):