Пример #1
0
def test_process_marked_lines():
    # quotations and last message lines are mixed
    # consider all to be a last message
    markers = 'tsemmtetm'
    lines = [str(i) for i in range(len(markers))]
    lines = [str(i) for i in range(len(markers))]

    eq_(lines, quotations.process_marked_lines(lines, markers))

    # no splitter => no markers
    markers = 'tmm'
    lines = ['1', '2', '3']
    eq_(['1', '2', '3'], quotations.process_marked_lines(lines, markers))

    # text after splitter without markers is quotation
    markers = 'tst'
    lines = ['1', '2', '3']
    eq_(['1'], quotations.process_marked_lines(lines, markers))

    # message + quotation + signature
    markers = 'tsmt'
    lines = ['1', '2', '3', '4']
    eq_(['1', '4'], quotations.process_marked_lines(lines, markers))

    # message + <quotation without markers> + nested quotation
    markers = 'tstsmt'
    lines = ['1', '2', '3', '4', '5', '6']
    eq_(['1'], quotations.process_marked_lines(lines, markers))

    # test links wrapped with paranthesis
    # link starts on the marker line
    markers = 'tsmttem'
    lines = [
        'text', 'splitter', '>View (http://example.com', '/abc', ')', '',
        '> quote'
    ]
    eq_(lines[:1], quotations.process_marked_lines(lines, markers))

    # link starts on the new line
    markers = 'tmmmtm'
    lines = [
        'text', '>'
        '>', '>', '(http://example.com) >  ',
        '> life is short. (http://example.com)  '
    ]
    eq_(lines[:1], quotations.process_marked_lines(lines, markers))

    # check all "inline" replies
    markers = 'tsmtmtm'
    lines = [
        'text', 'splitter', '>', '(http://example.com)', '>', 'inline  reply',
        '>'
    ]
    eq_(lines, quotations.process_marked_lines(lines, markers))

    # inline reply with link not wrapped in paranthesis
    markers = 'tsmtm'
    lines = [
        'text', 'splitter', '>', 'inline reply with link http://example.com',
        '>'
    ]
    eq_(lines, quotations.process_marked_lines(lines, markers))

    # inline reply with link wrapped in paranthesis
    markers = 'tsmtm'
    lines = [
        'text', 'splitter', '>', 'inline  reply (http://example.com)', '>'
    ]
    eq_(lines, quotations.process_marked_lines(lines, markers))
Пример #2
0
def test_process_marked_lines():
    # quotations and last message lines are mixed
    # consider all to be a last message
    markers = 'tsemmtetm'
    lines = [str(i) for i in range(len(markers))]
    lines = [str(i) for i in range(len(markers))]

    eq_(lines, quotations.process_marked_lines(lines, markers))

    # no splitter => no markers
    markers = 'tmm'
    lines = ['1', '2', '3']
    eq_(['1', '2', '3'], quotations.process_marked_lines(lines, markers))

    # text after splitter without markers is quotation
    markers = 'tst'
    lines = ['1', '2', '3']
    eq_(['1'], quotations.process_marked_lines(lines, markers))

    # message + quotation + signature
    markers = 'tsmt'
    lines = ['1', '2', '3', '4']
    eq_(['1', '4'], quotations.process_marked_lines(lines, markers))

    # message + <quotation without markers> + nested quotation
    markers = 'tstsmt'
    lines = ['1', '2', '3', '4', '5', '6']
    eq_(['1'], quotations.process_marked_lines(lines, markers))

    # test links wrapped with paranthesis
    # link starts on the marker line
    markers = 'tsmttem'
    lines = ['text',
             'splitter',
             '>View (http://example.com',
             '/abc',
             ')',
             '',
             '> quote']
    eq_(lines[:1], quotations.process_marked_lines(lines, markers))

    # link starts on the new line
    markers = 'tmmmtm'
    lines = ['text',
             '>'
             '>',
             '>',
             '(http://example.com) >  ',
             '> life is short. (http://example.com)  '
             ]
    eq_(lines[:1], quotations.process_marked_lines(lines, markers))

    # check all "inline" replies
    markers = 'tsmtmtm'
    lines = ['text',
             'splitter',
             '>',
             '(http://example.com)',
             '>',
             'inline  reply',
             '>']
    eq_(lines, quotations.process_marked_lines(lines, markers))

    # inline reply with link not wrapped in paranthesis
    markers = 'tsmtm'
    lines = ['text',
             'splitter',
             '>',
             'inline reply with link http://example.com',
             '>']
    eq_(lines, quotations.process_marked_lines(lines, markers))

    # inline reply with link wrapped in paranthesis
    markers = 'tsmtm'
    lines = ['text',
             'splitter',
             '>',
             'inline  reply (http://example.com)',
             '>']
    eq_(lines, quotations.process_marked_lines(lines, markers))
Пример #3
0
def test_process_marked_lines():
    # quotations and last message lines are mixed
    # consider all to be a last message
    markers = "tsemmtetm"
    lines = [str(i) for i in range(len(markers))]

    eq_(lines, quotations.process_marked_lines(lines, markers))

    # no splitter => no markers
    markers = "tmm"
    lines = ["1", "2", "3"]
    eq_(["1", "2", "3"], quotations.process_marked_lines(lines, markers))

    # text after splitter without markers is quotation
    markers = "tst"
    lines = ["1", "2", "3"]
    eq_(["1"], quotations.process_marked_lines(lines, markers))

    # message + quotation + signature
    markers = "tsmt"
    lines = ["1", "2", "3", "4"]
    eq_(["1", "4"], quotations.process_marked_lines(lines, markers))

    # message + <quotation without markers> + nested quotation
    markers = "tstsmt"
    lines = ["1", "2", "3", "4", "5", "6"]
    eq_(["1"], quotations.process_marked_lines(lines, markers))

    # test links wrapped with paranthesis
    # link starts on the marker line
    markers = "tsmttem"
    lines = [
        "text",
        "splitter",
        ">View (http://example.com",
        "/abc",
        ")",
        "",
        "> quote",
    ]
    eq_(lines[:1], quotations.process_marked_lines(lines, markers))

    # link starts on the new line
    markers = "tmmmtm"
    lines = [
        "text",
        ">"
        ">",
        ">",
        "(http://example.com) >  ",
        "> life is short. (http://example.com)  ",
    ]
    eq_(lines[:1], quotations.process_marked_lines(lines, markers))

    # check all "inline" replies
    markers = "tsmtmtm"
    lines = [
        "text", "splitter", ">", "(http://example.com)", ">", "inline  reply",
        ">"
    ]
    eq_(lines, quotations.process_marked_lines(lines, markers))

    # inline reply with link not wrapped in paranthesis
    markers = "tsmtm"
    lines = [
        "text", "splitter", ">", "inline reply with link http://example.com",
        ">"
    ]
    eq_(lines, quotations.process_marked_lines(lines, markers))

    # inline reply with link wrapped in paranthesis
    markers = "tsmtm"
    lines = [
        "text", "splitter", ">", "inline  reply (http://example.com)", ">"
    ]
    eq_(lines, quotations.process_marked_lines(lines, markers))