def test_basic_conversion(self): assert ( convert("!http://www.example.com/image.png!") == "![http://www.example.com/image.png](http://www.example.com/image.png)" ) assert convert("!attached-image.gif!" ) == "![attached-image.gif](attached-image.gif)"
def test_multiline(self): assert convert("{noformat}\npreformatted piece\nof text\n{noformat}" ) == "```\npreformatted piece\nof text\n```" assert (convert( "{noformat}\n\n\n preformatted piece\n of text\n\n{noformat}") == "```\n preformatted piece\n of text\n```") assert (convert( "{noformat} \n \n preformatted piece\n of text\n{noformat}") == "```\n \n \n preformatted piece\n of text\n```")
def test_subscript_color(self): assert ( convert("~text {color:blue}~text inside~{color} outside~") == '<sub>text <font color="blue"><sub>text inside</sub></font> outside</sub>' ) assert ( convert("~text {color:blue}contains~ token{color} outside~") == '<sub>text <font color="blue">contains~ token</font> outside</sub>' )
def test_strikethrough_color(self): assert ( convert("-text {color:green}-text inside-{color} outside-") == '~~text <font color="green">~~text inside~~</font> outside~~' ) assert ( convert("-text {color:green}contains- token{color} outside-") == '~~text <font color="green">contains- token</font> outside~~' )
def test_bold_color(self): assert ( convert("*text {color:red}*text inside*{color} outside*") == '**text <font color="red">**text inside**</font> outside**' ) assert ( convert("*text {color:red}contains* token{color} outside*") == r'**text <font color="red">contains\* token</font> outside**' )
def test_underline_color(self): assert ( convert("+text {color:blue}+text inside+{color} outside+") == 'text <font color="blue">text inside</font> outside' ) assert ( convert("+text {color:blue}contains+ token{color} outside+") == 'text <font color="blue">contains+ token</font> outside' )
def test_superscript_color(self): assert ( convert("^text {color:blue}^text inside^{color} outside^") == '<sup>text <font color="blue"><sup>text inside</sup></font> outside</sup>' ) assert ( convert("^text {color:blue}contains^ token{color} outside^") == '<sup>text <font color="blue">contains^ token</font> outside</sup>' )
def test_inlinequote_color(self): assert ( convert("??text {color:blue}??text inside??{color} outside??") == '<q>text <font color="blue"><q>text inside</q></font> outside</q>' ) assert ( convert("??text {color:blue}contains?? token{color} outside??") == '<q>text <font color="blue">contains?? token</font> outside</q>' )
def test_list_color_list(self): assert ( convert( """ * Item ** Second *** {color:red} Some text {color} **** Four """ ) == """ - Item - Second - <font color="red"> Some text </font> - Four """ ) assert ( convert( """ # Item ## Second ### {color:red} Some text {color} #### Four """ ) == """ 1. Item 1. Second 1. <font color="red"> Some text </font> 1. Four """ )
def test_start_indent(self): assert ( convert( """ # First ## Second ## One ### Two # Last ## One """ ) == """ 1. First 1. Second ## One ### Two 1. Last 1. One """ )
def test_title(self): assert (convert(""" {panel:title=My Title} Some text with a title {panel} """) == """ > **My Title** > Some text with a title """)
def test_basic_conversion(self): assert (convert(""" {panel} Some text more line {panel} """) == """ > Some text > more line """)
def test_multiple_parameters(self): assert (convert(""" {panel:borderStyle=dashed|borderColor=#ccc|title=My Title|titleBGColor=#F7D6C1|bgColor=#FFFFCE} a block of text surrounded with a panel {panel} """) == """ > **My Title** > a block of text > surrounded with a panel """)
def test_list_panel_list(self): assert ( convert( """ * Item ** Second *** {panel} Some quote {panel} **** Four """ ) == """ - Item - Second - > Some quote - Four """ ) assert ( convert( """ # Item ## Second ### {panel} Some quote {panel} #### Four """ ) == """ 1. Item 1. Second 1. > Some quote 1. Four """ )
def test_list_blockquote(self): assert ( convert( """ * Item ** Second *** {quote} Some quote {quote} **** Four """ ) == """ - Item - Second - > Some quote - Four """ ) assert ( convert( """ # Item ## Second ### {quote} Some quote {quote} #### Four """ ) == """ 1. Item 1. Second 1. > Some quote 1. Four """ )
def test_broken_list_markup(self): assert ( convert( """ ----- Hello, -World-! ----- """ ) == """ ----- Hello, ~~World~~! ----- """ ) assert ( convert( """ -- Hello {quote} World {quote} """ ) == """ – Hello > World """ ) assert ( convert( """ --------- -- """ ) == """ --------- – """ )
def test_multiple_parameters(self): assert (convert(""" {noformat:borderStyle=dashed|borderColor=#ccc|title=My Title|titleBGColor=#F7D6C1|bgColor=#FFFFCE} a block of code surrounded with a noformat {noformat} """) == """ ``` a block of code surrounded with a noformat ``` """)
def test_default_language(self): assert (convert(""" {code} def test_code(): assert convert(...) {code} """) == """ ```Java def test_code(): assert convert(...) ``` """)
def test_empty_list(self): assert ( convert( """ # ## """ ) == r""" 1. 1. """ )
def test_text_indent(self): assert ( convert( """ Some text * """ ) == """ Some text - """ )
def test_explicit_language(self): assert (convert(""" {code:xml} <test> <another tag="attribute"/> </test> {code} """) == """ ```xml <test> <another tag="attribute"/> </test> ``` """)
def test_bullets(self): assert ( convert( """ * some * bullet ** indented ** bullets * points """ ) == """ - some - bullet - indented - bullets - points """ ) assert ( convert( """ - some - bullet -- indented -- bullets - points """ ) == """ - some - bullet - indented - bullets - points """ )
def test_start_indent(self): assert ( convert( """ * First ** Second ** One *** Two * Last ** One """ ) == r""" - First - Second \*\* One \*\*\* Two - Last - One """ ) assert ( convert( """ -- One --- Two """ ) == """ – One — Two """ )
def test_list(self): assert ( convert( """ {quote} * Item ** Line {quote} """ ) == """ > - Item > - Line """ )
def test_indent_step(self): assert ( convert( """ # one ## two #### four """ ) == r""" 1. one 1. two #### four """ )
def test_mixed_bullets(self): assert ( convert( """ #* nested #** bullet #** list """ ) == """ - nested - bullet - list """ )
def test_list(self): assert ( convert( """ {panel} * Item ** Line {panel} """ ) == """ > - Item > - Line """ )
def test_indent_step(self): assert ( convert( """ * one ** two **** four """ ) == r""" - one - two \*\*\*\* four """ )
def test_mixed_bullets(self): assert ( convert( """ *# nested *## numbered *## list """ ) == """ 1. nested 1. numbered 1. list """ )
def test_text_formatting(self): assert ( convert( """ {panel:title=My Title|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#FFFFCE} a block of text surrounded with a *panel* line with !image.png|width=300! {panel} """ ) == """ > **My Title** > a block of text surrounded with a **panel** > line with ![image.png](image.png) """ )