예제 #1
0
def test_simple():
    sect = get_reference_section_beginning(["Hello", "References", "[1] Ref1"])
    assert sect == {
        'marker': '[1]',
        'marker_pattern': u'\\s*(?P<mark>\\[\\s*(?P<marknum>\\d+)\\s*\\])',
        'start_line': 1,
        'title_string': 'References',
        'title_marker_same_line': False,
        'how_found_start': 1,
    }
예제 #2
0
def test_no_title_via_numbers2():
    sect = get_reference_section_beginning(["Hello", "1", "Ref1", "(3)", "2", "Ref2"])
    assert sect, {
        "marker": "1",
        "marker_pattern": u"(?P<mark>(?P<left>)\\s*(?P<marknum>\\d+)\\s*(?P<right>))",
        "start_line": 1,
        "title_string": None,
        "title_marker_same_line": False,
        "how_found_start": 4,
    }
예제 #3
0
def test_no_title_via_dots():
    sect = get_reference_section_beginning(["Hello", "1. Ref1" "2. Ref2"])
    assert sect == {
        "marker": "1.",
        "marker_pattern": u"(?P<mark>(?P<left>)\\s*(?P<marknum>\\d+)\\s*(?P<right>\\.))",
        "start_line": 1,
        "title_string": None,
        "title_marker_same_line": False,
        "how_found_start": 3,
    }
예제 #4
0
def test_no_title_via_brackets():
    sect = get_reference_section_beginning(["Hello", "[1] Ref1" "[2] Ref2"])
    assert sect == {
        "marker": "[1]",
        "marker_pattern": u"(?P<mark>(?P<left>\\[)\\s*(?P<marknum>\\d+)\\s*(?P<right>\\]))",
        "start_line": 1,
        "title_string": None,
        "title_marker_same_line": False,
        "how_found_start": 2,
    }
예제 #5
0
def test_simple():
    sect = get_reference_section_beginning(["Hello", "References", "[1] Ref1"])
    assert sect == {
        "marker": "[1]",
        "marker_pattern": u"\\s*(?P<mark>\\[\\s*(?P<marknum>\\d+)\\s*\\])",
        "start_line": 1,
        "title_string": "References",
        "title_marker_same_line": False,
        "how_found_start": 1,
    }
예제 #6
0
def test_no_title_via_numbers():
    sect = get_reference_section_beginning(["Hello", "1 Ref1" "2 Ref2"])
    assert sect == {
        'marker': '1',
        'marker_pattern':
        u'(?P<mark>(?P<left>)\\s*(?P<marknum>\\d+)\\s*(?P<right>))',
        'start_line': 1,
        'title_string': None,
        'title_marker_same_line': False,
        'how_found_start': 4,
    }
예제 #7
0
def test_no_title_via_brackets():
    sect = get_reference_section_beginning(["Hello", "[1] Ref1" "[2] Ref2"])
    assert sect == {
        'marker': '[1]',
        'marker_pattern':
        u'(?P<mark>(?P<left>\\[)\\s*(?P<marknum>\\d+)\\s*(?P<right>\\]))',
        'start_line': 1,
        'title_string': None,
        'title_marker_same_line': False,
        'how_found_start': 2,
    }
예제 #8
0
def test_no_section():
    sect = get_reference_section_beginning("")
    assert sect is None
예제 #9
0
def test_no_section():
    sect = get_reference_section_beginning("")
    assert sect is None