コード例 #1
0
ファイル: test.py プロジェクト: Nanko-Nanev/python_oop
 def test_add_song_published_album(self):
     album = Album("The Sound of Perseverance")
     song = Song("Scavenger of Human Sorrow", 6.56, False)
     album.publish()
     message = album.add_song(song)
     expected = "Cannot add songs. Album is published."
     self.assertEqual(message, expected)
コード例 #2
0
ファイル: test.py プロジェクト: Nanko-Nanev/python_oop
 def test_remove_album_published(self):
     band = Band("Death")
     album = Album("The Sound of Perseverance")
     album.publish()
     band.add_album(album)
     message = band.remove_album("The Sound of Perseverance")
     expected = "Album has been published. It cannot be removed."
     self.assertEqual(message, expected)
コード例 #3
0
from project.band import Band
from project.album import Album

from project.song import Song

if __name__ == "__main__":

    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())
コード例 #4
0
ファイル: test.py プロジェクト: Nanko-Nanev/python_oop
 def test_publish_message(self):
     album = Album("The Sound of Perseverance")
     message = album.publish()
     expected = "Album The Sound of Perseverance has been published."
     self.assertEqual(message, expected)
コード例 #5
0
ファイル: test.py プロジェクト: Nanko-Nanev/python_oop
 def test_publish(self):
     album = Album("The Sound of Perseverance")
     message = album.publish()
     expected = album.published
     self.assertTrue(expected)