Do not user upper-case for non-constants

This commit is contained in:
Philipp Hagemeister 2013-02-26 20:03:19 +01:00
parent 6bf48bd866
commit 679790eee1

View File

@ -35,56 +35,56 @@ class FakeDownloader(object):
class TestYoutubeLists(unittest.TestCase): class TestYoutubeLists(unittest.TestCase):
def test_youtube_playlist(self): def test_youtube_playlist(self):
DL = FakeDownloader() dl = FakeDownloader()
IE = YoutubePlaylistIE(DL) ie = YoutubePlaylistIE(dl)
IE.extract('https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re') ie.extract('https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re')
self.assertEqual(map(lambda x: YoutubeIE()._extract_id(x[0]), DL.result), self.assertEqual(map(lambda x: YoutubeIE()._extract_id(x[0]), dl.result),
[ 'bV9L5Ht9LgY', 'FXxLjLQi3Fg', 'tU3Bgo5qJZE' ]) [ 'bV9L5Ht9LgY', 'FXxLjLQi3Fg', 'tU3Bgo5qJZE' ])
#661 #661
DL = FakeDownloader() dl = FakeDownloader()
IE = YoutubePlaylistIE(DL) ie = YoutubePlaylistIE(dl)
IE.extract('PLMCmkNmxw6Z9eduM7BZjSEh7HiU543Ig0') ie.extract('PLMCmkNmxw6Z9eduM7BZjSEh7HiU543Ig0')
self.assertTrue(len(DL.result) > 20) self.assertTrue(len(dl.result) > 20)
#673 #673
DL = FakeDownloader() dl = FakeDownloader()
IE = YoutubePlaylistIE(DL) ie = YoutubePlaylistIE(dl)
IE.extract('PLBB231211A4F62143') ie.extract('PLBB231211A4F62143')
self.assertTrue(len(DL.result) > 40) self.assertTrue(len(dl.result) > 40)
def test_youtube_playlist_long(self): def test_youtube_playlist_long(self):
DL = FakeDownloader() dl = FakeDownloader()
IE = YoutubePlaylistIE(DL) ie = YoutubePlaylistIE(dl)
IE.extract('https://www.youtube.com/playlist?list=UUBABnxM4Ar9ten8Mdjj1j0Q') ie.extract('https://www.youtube.com/playlist?list=UUBABnxM4Ar9ten8Mdjj1j0Q')
self.assertTrue(len(DL.result) >= 799) self.assertTrue(len(dl.result) >= 799)
def test_youtube_playlist_with_deleted(self): def test_youtube_playlist_with_deleted(self):
#651 #651
DL = FakeDownloader() dl = FakeDownloader()
IE = YoutubePlaylistIE(DL) ie = YoutubePlaylistIE(dl)
IE.extract('https://www.youtube.com/playlist?list=PLwP_SiAcdui0KVebT0mU9Apz359a4ubsC') ie.extract('https://www.youtube.com/playlist?list=PLwP_SiAcdui0KVebT0mU9Apz359a4ubsC')
self.assertFalse('pElCt5oNDuI' in map(lambda x: YoutubeIE()._extract_id(x[0]), DL.result)) self.assertFalse('pElCt5oNDuI' in map(lambda x: YoutubeIE()._extract_id(x[0]), dl.result))
self.assertFalse('KdPEApIVdWM' in map(lambda x: YoutubeIE()._extract_id(x[0]), DL.result)) self.assertFalse('KdPEApIVdWM' in map(lambda x: YoutubeIE()._extract_id(x[0]), dl.result))
def test_youtube_course(self): def test_youtube_course(self):
DL = FakeDownloader() dl = FakeDownloader()
IE = YoutubePlaylistIE(DL) ie = YoutubePlaylistIE(dl)
# TODO find a > 100 (paginating?) videos course # TODO find a > 100 (paginating?) videos course
IE.extract('https://www.youtube.com/course?list=ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8') ie.extract('https://www.youtube.com/course?list=ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8')
self.assertEqual(YoutubeIE()._extract_id(DL.result[0][0]), 'j9WZyLZCBzs') self.assertEqual(YoutubeIE()._extract_id(dl.result[0][0]), 'j9WZyLZCBzs')
self.assertEqual(len(DL.result), 25) self.assertEqual(len(dl.result), 25)
self.assertEqual(YoutubeIE()._extract_id(DL.result[-1][0]), 'rYefUsYuEp0') self.assertEqual(YoutubeIE()._extract_id(dl.result[-1][0]), 'rYefUsYuEp0')
def test_youtube_channel(self): def test_youtube_channel(self):
# I give up, please find a channel that does paginate and test this like test_youtube_playlist_long # I give up, please find a channel that does paginate and test this like test_youtube_playlist_long
pass # TODO pass # TODO
def test_youtube_user(self): def test_youtube_user(self):
DL = FakeDownloader() dl = FakeDownloader()
IE = YoutubeUserIE(DL) ie = YoutubeUserIE(dl)
IE.extract('https://www.youtube.com/user/TheLinuxFoundation') ie.extract('https://www.youtube.com/user/TheLinuxFoundation')
self.assertTrue(len(DL.result) >= 320) self.assertTrue(len(dl.result) >= 320)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()