Ejemplo n.º 1
0
def test_newlines_long_group():
    """Convert newlines in even long groups."""
    assert (
        gfm("apple\npear\norange\nbanana\n\nruby\npython\nerlang")
        == "apple  \npear  \norange  \nbanana\n\nruby  \npython  \nerlang"
    )
Ejemplo n.º 2
0
def test_newlines_simple():
    """Turn newlines into br tags in simple cases."""
    assert gfm("foo\nbar") == "foo  \nbar"
Ejemplo n.º 3
0
def test_newlines_group():
    """Convert newlines in all groups."""
    assert (
        gfm("apple\npear\norange\n\nruby\npython\nerlang")
        == "apple  \npear  \norange\n\nruby  \npython  \nerlang"
    )
Ejemplo n.º 4
0
def test_two_underscores():
    """Escape two or more underscores inside words."""
    assert gfm("foo_bar_baz") == "foo\\_bar\\_baz"
Ejemplo n.º 5
0
def test_single_underscores():
    """Don't touch single underscores inside words."""
    assert gfm("foo_bar") == "foo_bar"
Ejemplo n.º 6
0
def test_pre_block_pre_text():
    """Don't treat pre blocks with pre-text differently."""
    a = "\n\n<pre>\nthis is `a\\_test` and this\\_too\n</pre>"
    b = "hmm<pre>\nthis is `a\\_test` and this\\_too\n</pre>"
    assert gfm(a)[2:] == gfm(b)[3:]
Ejemplo n.º 7
0
def test_pre_block_pre_text():
    """Don't treat pre blocks with pre-text differently."""
    a = "\n\n<pre>\nthis is `a\\_test` and this\\_too\n</pre>"
    b = "hmm<pre>\nthis is `a\\_test` and this\\_too\n</pre>"
    assert gfm(a)[2:] == gfm(b)[3:]
Ejemplo n.º 8
0
def test_newlines_list():
    """Don't convert newlines in lists."""
    assert gfm("# foo\n# bar") == "# foo\n# bar"
    assert gfm("* foo\n* bar") == "* foo\n* bar"
Ejemplo n.º 9
0
def test_underscores_code_blocks():
    """Don't touch underscores in code blocks."""
    assert gfm("    foo_bar_baz") == "    foo_bar_baz"
Ejemplo n.º 10
0
def test_newlines_group():
    """Convert newlines in all groups."""
    assert (gfm("apple\npear\norange\n\nruby\npython\nerlang") ==
            "apple  \npear  \norange\n\nruby  \npython  \nerlang")
Ejemplo n.º 11
0
def test_newlines_long_group():
    """Convert newlines in even long groups."""
    assert (gfm("apple\npear\norange\nbanana\n\nruby\npython\nerlang") ==
            "apple  \npear  \norange  \nbanana\n\nruby  \npython  \nerlang")
Ejemplo n.º 12
0
def test_newlines_simple():
    """Turn newlines into br tags in simple cases."""
    assert gfm("foo\nbar") == "foo  \nbar"
Ejemplo n.º 13
0
def test_single_underscores():
    """Don't touch single underscores inside words."""
    assert gfm("foo_bar") == "foo_bar"
Ejemplo n.º 14
0
def test_two_underscores():
    """Escape two or more underscores inside words."""
    assert gfm("foo_bar_baz") == "foo\\_bar\\_baz"
Ejemplo n.º 15
0
def test_newlines_list():
    """Don't convert newlines in lists."""
    assert gfm("# foo\n# bar") == "# foo\n# bar"
    assert gfm("* foo\n* bar") == "* foo\n* bar"
Ejemplo n.º 16
0
def test_underscores_pre_blocks():
    """Don't touch underscores in pre blocks."""
    assert gfm("<pre>\nfoo_bar_baz\n</pre>") == "\n\n<pre>\nfoo_bar_baz\n</pre>"
Ejemplo n.º 17
0
def test_underscores_code_blocks():
    """Don't touch underscores in code blocks."""
    assert gfm("    foo_bar_baz") == "    foo_bar_baz"
Ejemplo n.º 18
0
def test_underscores_pre_blocks():
    """Don't touch underscores in pre blocks."""
    assert gfm(
        "<pre>\nfoo_bar_baz\n</pre>") == "\n\n<pre>\nfoo_bar_baz\n</pre>"