Example #1
0
 def test_details(self):
     album = Album("The Sound of Perseverance")
     song = Song("Scavenger of Human Sorrow", 6.56, False)
     album.add_song(song)
     message = album.details()
     expected = "Album The Sound of Perseverance\n== Scavenger of Human Sorrow - 6.56\n"
Example #2
0
 def test_add_song_single(self):
     album = Album("The Sound of Perseverance")
     song = Song("Scavenger of Human Sorrow", 6.56, True)
     message = album.add_song(song)
     expected = "Cannot add Scavenger of Human Sorrow. It's a single"
     self.assertEqual(message, expected)
Example #3
0
        if self.published:
            return f"Album {self.name} is already puplished."
        self.published = True
        return f"Album {self.name} has been published."

    def details(self):
        res = '\n'.join(f"== {s.get_info()}" for s in self.songs)
        return f"Album {self.name}\n" \
               f"{res}"


song = Song("Running in the 90s", 3.45, False)
print(song.get_info())
album = Album("Initial D", song)
second_song = Song("Around the World", 2.34, False)
print(album.add_song(second_song))
print(album.details())
print(album.publish())
band = Band("Manuel")
print(band.add_album(album))
print(band.remove_album("Initial D"))
print(band.details())

from project.song import Song
from project.album import Album
from project.band import Band

import unittest


class SongTest(unittest.TestCase):
Example #4
0
 def test_add_song_working(self):
     album = Album("The Sound of Perseverance")
     song = Song("Scavenger of Human Sorrow", 6.56, False)
     message = album.add_song(song)
     expected = "Song Scavenger of Human Sorrow has been added to the album The Sound of Perseverance."
     self.assertEqual(message, expected)