本文整理汇总了Python中song.Song.getArtist方法的典型用法代码示例。如果您正苦于以下问题:Python Song.getArtist方法的具体用法?Python Song.getArtist怎么用?Python Song.getArtist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类song.Song
的用法示例。
在下文中一共展示了Song.getArtist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_search_results
# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import getArtist [as 别名]
def test_add_search_results(self):
print "testing if chosen search result is added correctly"
text = "wonderwall"
results = spotify.search(text, limit = 10, type = 'track')
title = results['tracks']['items'][0]['name']
artist = results['tracks']['items'][0]['artists'][0]['name']
uri = results['tracks']['items'][0]['uri']
song1 = Song(1, title, artist, uri)
assert 'Wonderwall' in song1.getTitle()
assert 'Oasis' in song1.getArtist()
示例2: TestSong
# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import getArtist [as 别名]
class TestSong(unittest.TestCase):
def setUp(self):
self.song = Song(title="Tra-la-la", artist="Pesho", album="Tarara", length="3:33")
self.second_song = Song(title="Tra-la-la", artist="Pesho", album="Tarara", length="3:33")
def test_getTitle_method(self):
self.assertEqual("Tra-la-la", self.song.getTitle())
def test_getArtist(self):
self.assertEqual("Pesho", self.song.getArtist())
def test_getAlbum(self):
self.assertEqual("Tarara", self.song.getAlbum())
def test_getLength(self):
self.assertEqual("3:33", self.song.getLength())
def test_str_(self):
self.assertEqual("Pesho - Tra-la-la from Tarara - 3:33", str(self.song))
def test_eq_(self):
self.assertTrue(self.song == self.second_song)
def test_hash_(self):
self.assertTrue(type(hash(self.song)) == int)
def test_length_without_arguments(self):
self.assertEqual(self.song.length(), "3:33")
def test_length_with_seconds(self):
self.assertEqual(self.song.length(seconds=True), 213)
def test_length_with_minutes(self):
self.assertEqual(self.song.length(minutes=True), 3)
def test_length_with_hours(self):
self.assertEqual(self.song.length(hours=True), 0)