Пример #1
0
 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'
     )
Пример #2
0
    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|
""")
Пример #3
0
    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|
""")
Пример #4
0
    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|
""")
Пример #5
0
    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|
""")
Пример #6
0
    def test_empty_rows(self):
        assert (convert("""
|
||
|text|
|
|end|
""") == """
|text|
|-|
|end|
""")
Пример #7
0
 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"
Пример #8
0
 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"
Пример #9
0
    def test_basic_conversion(self):
        assert (
            convert(
                """
{quote}
    here is quotable
        content to be quoted
{quote}
"""
            )
            == """
> here is quotable
> content to be quoted
"""
        )
Пример #10
0
 def test_multiline(self):
     assert (
         convert(
             """
     {color:red}
         look ma, red text!
     {color}
     """
         )
         == """
     <font color="red">
         look ma, red text!
     </font>
     """
     )
Пример #11
0
    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
""")
Пример #12
0
    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|
""")
Пример #13
0
 def test_basic_conversion(self):
     assert convert("h1. Title text") == "# Title text"
Пример #14
0
 def test_match_start_conditions(self):
     assert convert("  h2. Title") == "  ## Title"
     assert convert(" A  h2. Title") == " A  h2. Title"
Пример #15
0
 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>"
Пример #16
0
 def test_match_start_conditions(self):
     assert convert("no ?? space after start??") == "no ?? space after start??"
     assert convert("word??connector?? markup") == "word??connector?? markup"
Пример #17
0
 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"
Пример #18
0
 def test_indent(self):
     assert convert(" ---- ") == " \n----"
Пример #19
0
 def test_match_end_conditions(self):
     assert convert("+text +") == "+text +"
     assert convert("+word+connector") == "+word+connector"
     assert convert("+skip +spacing + char+") == "skip +spacing + char"
Пример #20
0
 def test_word_break(self):
     assert convert("abc\\\\def") == "abc\ndef"
Пример #21
0
 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"
Пример #22
0
 def test_basic_conversion(self):
     assert convert("inside +some long+ text") == "inside some long text"
Пример #23
0
 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~~-"
Пример #24
0
 def test_header_levels(self):
     assert convert("h6. Title") == "###### Title"
     assert convert("h7. Title") == "h7. Title"
Пример #25
0
 def test_basic_conversion(self):
     assert convert("----") == "\n----"
Пример #26
0
 def test_multiline(self):
     assert convert("+multiline\nunderline+") == "+multiline\nunderline+"
Пример #27
0
 def test_line_endings(self):
     assert convert("+start string end+") == "start string end"
     assert convert("\n+start line end+\n") == "\nstart line end\n"
Пример #28
0
 def test_basic_conversion(self):
     assert convert("inside ??some long?? text") == "inside <q>some long</q> text"
Пример #29
0
 def test_basic_conversion(self):
     assert convert("--") == "–"
     assert convert("abc -- def") == "abc – def"
Пример #30
0
 def test_match_start_conditions(self):
     assert convert("no + space after start+") == "no + space after start+"
     assert convert("word+connector+ markup") == "word+connector+ markup"