Ejemplo n.º 1
0
def test_tabs():
    path = sample_path('doctest_tabs.txt')
    parser = DocTestParser(optionflags=REPORT_NDIFF|ELLIPSIS)
    with pytest.raises(ValueError) as excinfo:
        Document.parse(path, parser)
    assert str(excinfo.value) == (
        'tabs are not supported, first one found at line 2, column 4'
    )
Ejemplo n.º 2
0
def test_directive_indent_equal_to_block():
    document = document_from_sample('capture_bad_indent2.txt')
    with pytest.raises(ValueError) as excinfo:
        list(parse_captures(document))
    assert str(excinfo.value) == (
            "couldn't find the start of the block to match'    .. -> foo' "
            "on line 5 of "+sample_path('capture_bad_indent2.txt')
        )
Ejemplo n.º 3
0
def test_directive_indent_beyond_block():
    document = document_from_sample('capture_bad_indent1.txt')
    with pytest.raises(ValueError) as excinfo:
        list(parse_captures(document))
    if PY3:
        block = "'        .. -> foo'"
    else:
        block = "u'        .. -> foo'"
    assert str(
        excinfo.value) == ("couldn't find the start of the block to match " +
                           block + " "
                           "on line 5 of " +
                           sample_path('capture_bad_indent1.txt'))
Ejemplo n.º 4
0
def test_tabs():
    path = sample_path('doctest_tabs.txt')
    parser = DocTestParser()
    with pytest.raises(ValueError):
        Document.parse(path, parser)