def test_xpath_with_ns(self): testxml = '''<root xmlns:media="http://example.com/"> <media:song> <media:author>The Author</media:author> <url>http://server.com/download.mp3</url> </media:song> </root>''' doc = compat_etree_fromstring(testxml) find = lambda p: doc.find(xpath_with_ns(p, {'media': 'http://example.com/'})) self.assertTrue(find('media:song') is not None) self.assertEqual(find('media:song/media:author').text, 'The Author') self.assertEqual(find('media:song/url').text, 'http://server.com/download.mp3')
def test_xpath_with_ns(self): testxml = """<root xmlns:media="http://example.com/"> <media:song> <media:author>The Author</media:author> <url>http://server.com/download.mp3</url> </media:song> </root>""" doc = compat_etree_fromstring(testxml) find = lambda p: doc.find(xpath_with_ns(p, {"media": "http://example.com/"})) self.assertTrue(find("media:song") is not None) self.assertEqual(find("media:song/media:author").text, "The Author") self.assertEqual(find("media:song/url").text, "http://server.com/download.mp3")
encodeFilename, error_to_compat_str, DownloadError, determine_ext, ) from youtube_dl.downloader.common import FileDownloader from youtube_dl.extractor.common import InfoExtractor from youtube_dl.postprocessor.ffmpeg import FFmpegPostProcessorError from bbb_dl.ffmpeg import FFMPEG from bbb_dl.version import __version__ _s = lambda p: xpath_with_ns(p, {'svg': 'http://www.w3.org/2000/svg'}) _x = lambda p: xpath_with_ns(p, {'xlink': 'http://www.w3.org/1999/xlink'}) def dummy_to_stderr(self, message): return class Slide: def __init__( self, img_id: str, url: str, filename: str, path: str, width: int,