当前位置: 首页>>代码示例>>Python>>正文


Python Song.getTitle方法代码示例

本文整理汇总了Python中song.Song.getTitle方法的典型用法代码示例。如果您正苦于以下问题:Python Song.getTitle方法的具体用法?Python Song.getTitle怎么用?Python Song.getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在song.Song的用法示例。


在下文中一共展示了Song.getTitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_song_score

# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import getTitle [as 别名]
	def test_song_score(self):
		print "testing if song score is modified correctly"
		song = Song(1, "TestSong", "TestArtist", 0)
		assert 'TestSong' in song.getTitle()
		assert 1 == song.getScore()
		song.incrementScore()
		assert 2 == song.getScore()
		song.decrementScore()
		assert 1 == song.getScore()
开发者ID:EvanJRichter,项目名称:PartyFy,代码行数:11,代码来源:hello_tests.py

示例2: test_add_search_results

# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import getTitle [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()
开发者ID:EvanJRichter,项目名称:PartyFy,代码行数:12,代码来源:hello_tests.py

示例3: TestSong

# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import getTitle [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)
开发者ID:presian,项目名称:HackBulgaria,代码行数:40,代码来源:song_test.py

示例4: test_create_song

# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import getTitle [as 别名]
	def test_create_song(self):
		print "testing if songs are created correctly"
		song = Song(1, "TestSong", "TestArtist", 0)
		assert 'TestSong' in song.getTitle()
		assert 1 == song.getId()
开发者ID:EvanJRichter,项目名称:PartyFy,代码行数:7,代码来源:hello_tests.py


注:本文中的song.Song.getTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。