Пример #1
0
 def test_simple_links(self):
     # make sure the shuffled sequence does not lose any elements
     tp = TextParser(self.text)
     tp.extract_urls()
     self.assertEqual(
         tp.urls,
         [
             "http://www.youtube.com/watch?v=zGXAVw3vF9A",
             "http://www.slideshare.net/startuplessonslearned/2012-05-15-" "eric-ries-the-lean-startup-pwc-canada",
             "http://www.nytimes.com/2010/04/25/business/25unboxed.html",
         ],
     )
Пример #2
0
 def test_complex_urls(self):
     # make sure the shuffled sequence does not lose any elements
     text = """
     Check out this video of Eric Ries
     http://bit.ly/abc from
     Stanford University. It's a good start to understand Lean Startup.
     Here is a presentation
     you need to see as well
     bit.ly/xyz
     NYTIme recently covered him too
     www.a.long.and.weird.url.com/yep
     Steve
     """
     tp = TextParser(text)
     tp.extract_urls()
     self.assertEqual(tp.urls, ["http://bit.ly/abc", "http://bit.ly/xyz", "http://www.a.long.and.weird.url.com/yep"])