def test_color_value(self): assert ( convert("start {color:#0077ff}hex color{color} text") == 'start <font color="#0077ff">hex color</font> text' ) assert convert("start {color:red}named color{color} text") == 'start <font color="red">named color</font> text' assert ( convert("start {color:rgba(255, 127, 63, 0.3)}rgba color{color} text") == 'start <font color="#ff7f3f">rgba color</font> text' )
def test_mixed_column_separator(self): assert (convert(""" |header 1||header 2|header 3| |cell 1-1|cell 1-2||cell 1-3| ||cell 2-1|cell 2-2|cell 2-3| """) == """ |header 1|header 2|header 3| |-|-|-| |cell 1-1|cell 1-2|cell 1-3| |cell 2-1|cell 2-2|cell 2-3| """)
def test_open_end_row(self): assert (convert(""" ||header 1||header 2||header 3 |cell 1-1|cell 1-2 |cell 2-1 """) == """ |header 1|header 2|header 3| |-|-|-| |cell 1-1|cell 1-2| |cell 2-1| """)
def test_basic_conversion(self): assert (convert(""" ||header 1||header 2||header 3|| |cell 1-1|cell 1-2|cell 1-3| |cell 2-1|cell 2-2|cell 2-3| """) == """ |header 1|header 2|header 3| |-|-|-| |cell 1-1|cell 1-2|cell 1-3| |cell 2-1|cell 2-2|cell 2-3| """)
def test_uneven_columns_count(self): assert (convert(""" |header 1|header 2| |cell 1-1|cell 1-2|cell 1-3| |cell 2-1| """) == """ |header 1|header 2|| |-|-|-| |cell 1-1|cell 1-2|cell 1-3| |cell 2-1| """)
def test_empty_rows(self): assert (convert(""" | || |text| | |end| """) == """ |text| |-| |end| """)
def test_word_connections(self): assert convert("abc----def") == "abc----def" assert convert("abc ----def") == "abc ----def" assert convert("abc---- def") == "abc---- def" assert convert("abc ---- def") == "abc ---- def" assert convert("abc ---- ") == "abc ---- " assert convert(" ---- def") == " ---- def"
def test_spacing(self): assert convert("text[~userA]") == "text @userA" assert convert("[~userA]text") == "@userA text" assert convert("[~userA][~userB]") == "@userA @userB" assert convert("[~userA] [~userB]") == "@userA @userB" assert convert("[~userA]\t[~userB]") == "@userA\t@userB" assert convert("[~userA]\n[~userB]") == "@userA\n@userB"
def test_basic_conversion(self): assert ( convert( """ {quote} here is quotable content to be quoted {quote} """ ) == """ > here is quotable > content to be quoted """ )
def test_multiline(self): assert ( convert( """ {color:red} look ma, red text! {color} """ ) == """ <font color="red"> look ma, red text! </font> """ )
def test_table_adjacent_text(self): assert (convert(""" text before table ||header 1||header 2|| |cell 1-1|cell 1-2| text after table """) == """ text before table |header 1|header 2| |-|-| |cell 1-1|cell 1-2| text after table """)
def test_multiline_text(self): assert (convert(""" |multi line header| |multi line row|sibling row| |open end row """) == """ |multi<br>line <br>header|| |-|-| |multi<br>line <br>row|sibling row| |open <br>end <br>row| """)
def test_basic_conversion(self): assert convert("h1. Title text") == "# Title text"
def test_match_start_conditions(self): assert convert(" h2. Title") == " ## Title" assert convert(" A h2. Title") == " A h2. Title"
def test_match_end_conditions(self): assert convert("??text ??") == "??text ??" assert convert("??word??connector") == "??word??connector" assert convert("??skip ??spacing ?? char??") == "<q>skip ??spacing ?? char</q>"
def test_match_start_conditions(self): assert convert("no ?? space after start??") == "no ?? space after start??" assert convert("word??connector?? markup") == "word??connector?? markup"
def test_line_endings(self): assert convert("??start string end??") == "<q>start string end</q>" assert convert("\n??start line end??\n") == "\n<q>start line end</q>\n"
def test_indent(self): assert convert(" ---- ") == " \n----"
def test_match_end_conditions(self): assert convert("+text +") == "+text +" assert convert("+word+connector") == "+word+connector" assert convert("+skip +spacing + char+") == "skip +spacing + char"
def test_word_break(self): assert convert("abc\\\\def") == "abc\ndef"
def test_line_endings(self): assert convert("*start string end*") == "**start string end**" assert convert("\n*start line end*\n") == "\n**start line end**\n"
def test_basic_conversion(self): assert convert("inside +some long+ text") == "inside some long text"
def test_adjacent_tokens(self): assert convert("-some--text-") == "~~some~~ ~~text~~" assert convert("-some- -text-") == "~~some~~ ~~text~~" assert convert("--text--") == "-~~text~~-" assert convert("--some----text--") == "-~~some~~--~~text~~-"
def test_header_levels(self): assert convert("h6. Title") == "###### Title" assert convert("h7. Title") == "h7. Title"
def test_basic_conversion(self): assert convert("----") == "\n----"
def test_multiline(self): assert convert("+multiline\nunderline+") == "+multiline\nunderline+"
def test_line_endings(self): assert convert("+start string end+") == "start string end" assert convert("\n+start line end+\n") == "\nstart line end\n"
def test_basic_conversion(self): assert convert("inside ??some long?? text") == "inside <q>some long</q> text"
def test_basic_conversion(self): assert convert("--") == "–" assert convert("abc -- def") == "abc – def"
def test_match_start_conditions(self): assert convert("no + space after start+") == "no + space after start+" assert convert("word+connector+ markup") == "word+connector+ markup"