def test_find_urls(self): text = "<i>http://google.com/something</b>" " and >+https://maps.yandex.ru<a> " urls = util.find_urls(text) self.assertEqual(2, len(urls)) self.assertIn("http://google.com/something", urls) self.assertIn("https://maps.yandex.ru", urls)
def test_find_urls(self): text = "<i>http://google.com/something</b>" \ " and >+https://maps.yandex.ru<a> " urls = util.find_urls(text) self.assertEqual(2, len(urls)) self.assertIn('http://google.com/something', urls) self.assertIn('https://maps.yandex.ru', urls)
def extract_urls(text): iso, torrent = None, None if text: urls = util.find_urls(text) iso = util.try_index(urls, 0) torrent = util.try_index(urls, 1) return iso, torrent
def find_bugs(build): descr = build['description'] if not descr: return [] urls = util.find_urls(descr) bugs = [re.findall(r"\d{7}", x) for x in urls] if not bugs: return bugs bugs = sum(bugs, []) bugs = map(int, bugs) bugs = list(set(bugs)) return bugs
def test_find_no_urls(self): text = "Move along... https:// Nothing to see..." urls = util.find_urls(text) self.assertEqual([], urls)