Esempio n. 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,
    }
Esempio n. 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,
    }
Esempio n. 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,
    }
Esempio n. 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,
    }
Esempio n. 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,
    }
Esempio n. 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,
    }
Esempio n. 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,
    }
Esempio n. 8
0
def test_no_section():
    sect = get_reference_section_beginning("")
    assert sect is None
Esempio n. 9
0
def test_no_section():
    sect = get_reference_section_beginning("")
    assert sect is None