Exemplo n.º 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'}
Exemplo n.º 2
0
def test_single_snippet():
    assert collect_from_lines(['RDOC test', 'Test', 'ENDRDOC']) == {'test': 'Test'}
Exemplo n.º 3
0
def test_no_snippets_in_empty_file():
    assert collect_from_lines(['']) == {}
Exemplo n.º 4
0
def test_multiple_rdocs_in_file():
    with pytest.raises(ValueError):
        collect_from_lines(2*['# RDOC test', '# Test', '# ENDRDOC'])
Exemplo n.º 5
0
def test_basic_snippet_w_offset():
    assert collect_from_lines(['# RDOC test', '# Test', '# ENDRDOC']) == {'test': 'Test'}
Exemplo n.º 6
0
def test_missing_key():
    with pytest.raises(ValueError):
        collect_from_lines(['RDOC', 'Test', 'ENDRDOC'])
Exemplo n.º 7
0
def test_reach_end_without_end_snippet():
    with pytest.raises(ValueError):
        collect_from_lines(['RDOC test', 'Test'])
Exemplo n.º 8
0
def test_mismatched_start_stop_token_indents():
    with pytest.raises(ValueError):
        collect_from_lines(['RDOC test', 'Test', ' ENDRDOC'])
Exemplo n.º 9
0
def test_two_snippets():
    assert collect_from_lines([
        'RDOC one', 'Test', 'ENDRDOC',
        'RDOC two', 'Test', 'ENDRDOC',
    ]) == {'one': 'Test', 'two': 'Test'}