Exemple #1
0
def test_2_lines_together():
    marker_pattern = r"\s*(?P<mark>\[\s*(?P<marknum>\d+)\s*\])"
    refs = [
        u"[1] hello",
        u"hello2 [2] foo",
    ]
    rebuilt_refs = rebuild_reference_lines(refs, marker_pattern)
    assert rebuilt_refs == [
        u"[1] hello hello2",
        u"[2] foo",
    ]
Exemple #2
0
def test_2_lines_together():
    marker_pattern = ur"\s*(?P<mark>\[\s*(?P<marknum>\d+)\s*\])"
    refs = [
        u"[1] hello",
        u"hello2 [2] foo",
    ]
    rebuilt_refs = rebuild_reference_lines(refs, marker_pattern)
    assert rebuilt_refs == [
        u"[1] hello hello2",
        u"[2] foo",
    ]
Exemple #3
0
def test_simple():
    marker_pattern = ur"^\s*(?P<mark>\[\s*(?P<marknum>\d+)\s*\])"
    refs = [
        u"[1] hello",
        u"hello2",
        u"[2] foo",
    ]
    rebuilt_refs = rebuild_reference_lines(refs, marker_pattern)
    assert rebuilt_refs == [
        u"[1] hello hello2",
        u"[2] foo",
    ]
Exemple #4
0
def test_pagination_non_removal():
    marker_pattern = r"^\s*(?P<mark>\[\s*(?P<marknum>\d+)\s*\])"
    refs = [
        u"[1] hello",
        u"hello2",
        u"[2]",
        u"foo",
    ]
    rebuilt_refs = rebuild_reference_lines(refs, marker_pattern)
    assert rebuilt_refs == [
        u"[1] hello hello2",
        u"[2] foo",
    ]
Exemple #5
0
def test_pagination_non_removal():
    marker_pattern = ur"^\s*(?P<mark>\[\s*(?P<marknum>\d+)\s*\])"
    refs = [
        u"[1] hello",
        u"hello2",
        u"[2]",
        u"foo",
    ]
    rebuilt_refs = rebuild_reference_lines(refs, marker_pattern)
    assert rebuilt_refs == [
        u"[1] hello hello2",
        u"[2] foo",
    ]