def test_link_other_proj_no_html2text(self): # without html2text, the dash in other-project doesn't get escaped right html = BeautifulSoup('''<pre>Foo: <a href="/p/other-project/issues/detail?id=1">issue other-project:1</a></pre>''') assert_equal( _as_markdown(html.first(), 'myproj'), 'Foo: [issue other\\-project:1](https://code.google.com/p/other-project/issues/detail?id=1)' )
def test_unicode(self): tag = self.soup(u'\ua000 foo <a href="http://example.com/">bar</a>') res = google._as_markdown(tag, 'pn') self.assertEqual(res, u'\ua000 foo [bar](http://example.com/)')
def test_link_within_proj(self): html = BeautifulSoup('''<pre>Foo: <a href="/p/myproj/issues/detail?id=1">issue 1</a></pre>''') assert_equal( _as_markdown(html.first(), 'myproj'), 'Foo: [issue 1](#1)' )
def test_link_hosted_domain_other_proj(self): html = BeautifulSoup('''<pre>Foo: <a href="/a/eclipselabs.org/p/other-proj/issues/detail?id=1">issue 1</a></pre>''') assert_equal( _as_markdown(html.first(), 'a/eclipselabs.org/p/myproj'), 'Foo: [issue 1](https://code.google.com/a/eclipselabs.org/p/other-proj/issues/detail?id=1)' )
def test_link_other_proj_has_html2text(self): html = BeautifulSoup('''<pre>Foo: <a href="/p/other-project/issues/detail?id=1">issue other-project:1</a></pre>''') assert_equal( _as_markdown(html.first(), 'myproj'), 'Foo: [issue other-project:1](https://code.google.com/p/other-project/issues/detail?id=1)' )