File: test_textilefactory.py

package info (click to toggle)
python-textile 1%3A2.3.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 444 kB
  • ctags: 233
  • sloc: python: 2,320; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 1,001 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from textile import textilefactory
import pytest

def test_TextileFactory():
    f = textilefactory.TextileFactory()
    result = f.process("some text here")
    expect = '\t<p>some text here</p>'
    assert result == expect

    f = textilefactory.TextileFactory(restricted=True)
    result = f.process("more text here")
    expect = '\t<p>more text here</p>'
    assert result == expect

    f = textilefactory.TextileFactory(noimage=True)
    result = f.process("this covers a partial branch.")
    expect = '\t<p>this covers a partial branch.</p>'
    assert result == expect

    # Certain parameter values are not permitted because they are illogical:

    with pytest.raises(ValueError) as ve:
        f = textilefactory.TextileFactory(lite=True)
    assert 'lite can only be enabled in restricted mode' in str(ve.value)

    with pytest.raises(ValueError) as ve:
        f = textilefactory.TextileFactory(html_type='invalid')
    assert "html_type must be 'xhtml' or 'html5'" in str(ve.value)