Esempio n. 1
0
 def test_auto_link_in_angle_brackets(self):
     markup = "foo <http://example.com/> bar"
     expected_html = 'foo &lt;<a href="http://example.com/">http://example.com/</a>&gt; bar'
     actual_html = Text(markup).html
     try:
         assert actual_html == expected_html
     except AssertionError as err:
         print(markup + "\n" + actual_html + " != " + expected_html)
         raise err
Esempio n. 2
0
 def test_unclosed_link(self):
     line = Text("foo [[bar")
     assert line.html == 'foo <a href="bar">bar</a>'
Esempio n. 3
0
 def test_nested_tags_without_explicit_end(self):
     line = Text("foo **//bar**")
     assert line.html == "foo <strong><em>bar</em></strong>"
Esempio n. 4
0
 def test_code_can_contain_ampersand(self):
     line = Text("foo ``bar & baz``")
     assert line.html == "foo <code>bar &amp; baz</code>"
Esempio n. 5
0
 def test_oddly_nested_tags(self):
     line = Text("foo **//**bar**//**")
     assert line.html == "foo <strong><em></em></strong>bar<strong><em></em></strong>"
Esempio n. 6
0
 def test_sub(self):
     line = Text("foo __bar__")
     assert line.html == "foo <sub>bar</sub>"
Esempio n. 7
0
 def test_code(self):
     line = Text("foo ``bar``")
     assert line.html == "foo <code>bar</code>"
Esempio n. 8
0
 def test_em(self):
     line = Text("foo //bar//")
     assert line.html == "foo <em>bar</em>"
Esempio n. 9
0
 def test_auto_link(self):
     line = Text("foo http://example.com/ bar")
     assert line.html == 'foo <a href="http://example.com/">http://example.com/</a> bar'
Esempio n. 10
0
 def test_trailing_tilde(self):
     line = Text("foo bar ~")
     assert line.html == "foo bar ~"
Esempio n. 11
0
 def test_escaped_asterisks(self):
     line = Text("foo ~** bar")
     assert line.html == "foo ** bar"
Esempio n. 12
0
 def test_link_with_complex_description(self):
     line = Text(
         "[[http://www.example.com/stuff|this is a //really// interesting link --> {{image.jpg}}]]"
     )
     assert line.html == '<a href="http://www.example.com/stuff">this is a <em>really</em> interesting link &rarr; <img src="image.jpg"></a>'
Esempio n. 13
0
 def test_unclosed_link_with_image_description(self):
     line = Text("foo [[bar|{{image.jpg")
     assert line.html == 'foo <a href="bar"><img src="image.jpg"></a>'
Esempio n. 14
0
 def test_link_with_description_and_markup(self):
     line = Text("foo [[bar|this is an **important** link]]")
     assert line.html == 'foo <a href="bar">this is an <strong>important</strong> link</a>'
Esempio n. 15
0
 def test_link_with_description(self):
     line = Text("foo [[bar|description & things]]")
     assert line.html == 'foo <a href="bar">description &amp; things</a>'
Esempio n. 16
0
 def test_strong_at_start_of_line(self):
     line = Text("**foo** bar")
     assert line.html == "<strong>foo</strong> bar"
Esempio n. 17
0
 def test_single_asterisks(self):
     line = Text("foo *bar*")
     assert line.html == "foo *bar*"
Esempio n. 18
0
 def test_auto_link_with_trailing_dot(self):
     line = Text("foo http://example.com/. bar")
     assert line.html == 'foo <a href="http://example.com/">http://example.com/</a>. bar'
Esempio n. 19
0
 def test_single_slashes(self):
     line = Text("7 / 10")
     assert line.html == "7 / 10"
Esempio n. 20
0
 def test_no_content(self):
     line = Text("")
     assert line.html == ""
Esempio n. 21
0
 def test_sup(self):
     line = Text("foo ^^bar^^")
     assert line.html == "foo <sup>bar</sup>"
Esempio n. 22
0
 def test_no_tags(self):
     line = Text("foo bar")
     assert line.html == "foo bar"
Esempio n. 23
0
 def test_q(self):
     line = Text('foo ""bar""')
     assert line.html == "foo <q>bar</q>"
Esempio n. 24
0
 def test_ampersand(self):
     line = Text("foo & bar")
     assert line.html == "foo &amp; bar"
Esempio n. 25
0
 def test_code_does_not_nest(self):
     line = Text("foo ``bar ** baz // qux``")
     assert line.html == "foo <code>bar ** baz // qux</code>"
Esempio n. 26
0
 def test_entities(self):
     line = Text("foo & ' \" < > bar")
     assert line.html == "foo &amp; &apos; &quot; &lt; &gt; bar"
Esempio n. 27
0
 def test_tag_without_explicit_end(self):
     line = Text("foo **bar")
     assert line.html == "foo <strong>bar</strong>"
Esempio n. 28
0
 def test_strong(self):
     line = Text("foo **bar**")
     assert line.html == "foo <strong>bar</strong>"
Esempio n. 29
0
 def test_image(self):
     line = Text("foo {{bar.png}}")
     assert line.html == 'foo <img src="bar.png">'
Esempio n. 30
0
 def test_external_link_with_trailing_slash(self):
     line = Text("foo [[http://www.example.com/stuff/]]")
     assert line.html == 'foo <a href="http://www.example.com/stuff/">http://www.example.com/stuff/</a>'