HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //lib/python3/dist-packages/borg/testsuite/nanorst.py
import pytest

from ..nanorst import rst_to_text


def test_inline():
    assert rst_to_text('*foo* and ``bar``.') == 'foo and bar.'


def test_inline_spread():
    assert rst_to_text('*foo and bar, thusly\nfoobar*.') == 'foo and bar, thusly\nfoobar.'


def test_comment_inline():
    assert rst_to_text('Foo and Bar\n.. foo\nbar') == 'Foo and Bar\n.. foo\nbar'


def test_inline_escape():
    assert rst_to_text('Such as "\\*" characters.') == 'Such as "*" characters.'


def test_comment():
    assert rst_to_text('Foo and Bar\n\n.. foo\nbar') == 'Foo and Bar\n\nbar'


def test_directive_note():
    assert rst_to_text('.. note::\n   Note this and that') == 'Note:\n   Note this and that'


def test_ref():
    references = {
        'foo': 'baz'
    }
    assert rst_to_text('See :ref:`fo\no`.', references=references) == 'See baz.'


def test_undefined_ref():
    with pytest.raises(ValueError) as exc_info:
        rst_to_text('See :ref:`foo`.')
    assert 'Undefined reference' in str(exc_info.value)