예제 #1
0
	def test_length_in_minutes(self):

		song1 = Song('title', 'artist', 'album', '2:55')
		song2 = Song('title2', 'artist2', 'album2', '02:03:55')
		song3 = Song('title3', 'artist3', 'album3', '00:58')

		mins1 = song1.length1(minutes=True)
		mins2 = song2.length1(minutes=True)
		mins3 = song3.length1(minutes=True)

		self.assertEqual(mins1, 2)
		self.assertEqual(mins2, 123)
		self.assertEqual(mins3, 0)
예제 #2
0
	def test_length_in_seconds(self):

		song1 = Song('title', 'artist', 'album', '02:55')
		song2 = Song('title2', 'artist2', 'album2', '02:03:55')
		song3 = Song('title3', 'artist3', 'album3', '00:58')

		secs1 = song1.length1(seconds=True)
		secs2 = song2.length1(seconds=True)
		secs3 = song3.length1(seconds=True)

		self.assertEqual(secs1, 175)
		self.assertEqual(secs2, 955)
		self.assertEqual(secs3, 58)
예제 #3
0
	def test_length_in_hours(self):

		song1 = Song('title', 'artist', 'album', '02:55')
		song2 = Song('title2', 'artist2', 'album2', '02:03:55')
		song3 = Song('title3', 'artist3', 'album3', '00:58')

		hours1 = song1.length1(hours=True)
		hours2 = song2.length1(hours=True)
		hours3 = song3.length1(hours=True)

		self.assertEqual(hours1, 0)
		self.assertEqual(hours2, 2)
		self.assertEqual(hours3, 0)
예제 #4
0
	def test_string_representation_of_length(self):

		song = Song('title', 'artist', 'album', '02:55')

		result = song.length1()
		expected = '02:55'

		self.assertEqual(result, expected)