def test_all_files(self): for dirpath, _, filenames in os.walk(rootDir): for basename in filenames: if not basename.endswith('.py'): continue if basename in IGNORED_FILES: continue fn = os.path.join(dirpath, basename) with io.open(fn, encoding='utf-8') as inf: code = inf.read() if "'" not in code and '"' not in code: continue assertRegexpMatches( self, code, r'(?:(?:#.*?|\s*)\n)*from __future__ import (?:[a-z_]+,\s*)*unicode_literals', 'unicode_literals import missing in %s' % fn) m = re.search(r'(?<=\s)u[\'"](?!\)|,|$)', code) if m is not None: self.assertTrue( m is None, 'u present in %s, around %s' % ( fn, code[m.start() - 10:m.end() + 10]))
def test_format_note(self): ydl = YoutubeDL() self.assertEqual(ydl._format_note({}), '') assertRegexpMatches(self, ydl._format_note({ 'vbr': 10, }), r'^\s*10k$') assertRegexpMatches(self, ydl._format_note({ 'fps': 30, }), r'^30fps$')
def test_soundcloud_playlist(self): dl = FakeYDL() ie = SoundcloudPlaylistIE(dl) result = ie.extract("http://api.soundcloud.com/playlists/4110309") self.assertIsPlaylist(result) self.assertEqual(result["id"], "4110309") self.assertEqual(result["title"], "TILT Brass - Bowery Poetry Club, August '03 [Non-Site SCR 02]") assertRegexpMatches(self, result["description"], r"TILT Brass - Bowery Poetry Club") self.assertEqual(len(result["entries"]), 6)
def test_soundcloud_playlist(self): dl = FakeYDL() ie = SoundcloudPlaylistIE(dl) result = ie.extract('http://api.soundcloud.com/playlists/4110309') self.assertIsPlaylist(result) self.assertEqual(result['id'], '4110309') self.assertEqual(result['title'], 'TILT Brass - Bowery Poetry Club, August \'03 [Non-Site SCR 02]') assertRegexpMatches( self, result['description'], r'TILT Brass - Bowery Poetry Club') self.assertEqual(len(result['entries']), 6)
def test_soundcloud_playlist(self): dl = FakeYDL() ie = SoundcloudPlaylistIE(dl) result = ie.extract('http://api.soundcloud.com/playlists/4110309') self.assertIsPlaylist(result) self.assertEqual(result['id'], '4110309') self.assertEqual( result['title'], 'TILT Brass - Bowery Poetry Club, August \'03 [Non-Site SCR 02]') assertRegexpMatches(self, result['description'], r'.*?TILT Brass - Bowery Poetry Club') self.assertEqual(len(result['entries']), 6)
def test_all_files(self): for dirpath, _, filenames in os.walk(rootDir): for basename in filenames: if not basename.endswith('.py'): continue if basename in IGNORED_FILES: continue fn = os.path.join(dirpath, basename) with io.open(fn, encoding='utf-8') as inf: code = inf.read() if "'" not in code and '"' not in code: continue assertRegexpMatches( self, code, r'(?:(?:#.*?|\s*)\n)*from __future__ import (?:[a-z_]+,\s*)*unicode_literals', 'unicode_literals import missing in %s' % fn) m = re.search(r'(?<=\s)u[\'"](?!\)|,|$)', code) if m is not None: self.assertTrue( m is None, 'u present in %s, around %s' % (fn, code[m.start() - 10:m.end() + 10]))