Beispiel #1
0
def test_basic_snippet_w_multiple_lines():
    assert collect_from_lines([
        '# RDOC test\n',
        '# 1\n',
        '#\n',
        '# 2\n',
        '# ENDRDOC']
    ) == {'test': '1\n\n2'}
Beispiel #2
0
def test_single_snippet():
    assert collect_from_lines(['RDOC test', 'Test', 'ENDRDOC']) == {'test': 'Test'}
Beispiel #3
0
def test_no_snippets_in_empty_file():
    assert collect_from_lines(['']) == {}
Beispiel #4
0
def test_multiple_rdocs_in_file():
    with pytest.raises(ValueError):
        collect_from_lines(2*['# RDOC test', '# Test', '# ENDRDOC'])
Beispiel #5
0
def test_basic_snippet_w_offset():
    assert collect_from_lines(['# RDOC test', '# Test', '# ENDRDOC']) == {'test': 'Test'}
Beispiel #6
0
def test_missing_key():
    with pytest.raises(ValueError):
        collect_from_lines(['RDOC', 'Test', 'ENDRDOC'])
Beispiel #7
0
def test_reach_end_without_end_snippet():
    with pytest.raises(ValueError):
        collect_from_lines(['RDOC test', 'Test'])
Beispiel #8
0
def test_mismatched_start_stop_token_indents():
    with pytest.raises(ValueError):
        collect_from_lines(['RDOC test', 'Test', ' ENDRDOC'])
Beispiel #9
0
def test_two_snippets():
    assert collect_from_lines([
        'RDOC one', 'Test', 'ENDRDOC',
        'RDOC two', 'Test', 'ENDRDOC',
    ]) == {'one': 'Test', 'two': 'Test'}