File: test_image.py

package info (click to toggle)
python-textile 1%3A4.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 452 kB
  • sloc: python: 2,620; sh: 7; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 775 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
from textile import Textile

def test_image():
    t = Textile()
    result = t.image('!/imgs/myphoto.jpg!:http://jsamsa.com')
    expect = ('<a href="{0}1:url"><img alt="" src="{0}2:url" /></a>'.format(
        t.uid))
    assert result == expect
    assert t.refCache[1] == 'http://jsamsa.com'
    assert t.refCache[2] == '/imgs/myphoto.jpg'

    result = t.image('!</imgs/myphoto.jpg!')
    expect = '<img align="left" alt="" src="{0}3:url" />'.format(t.uid)
    assert result == expect
    assert t.refCache[3] == '/imgs/myphoto.jpg'

    t = Textile(rel='nofollow')
    result = t.image('!/imgs/myphoto.jpg!:http://jsamsa.com')
    expect = ('<a href="{0}1:url" rel="nofollow"><img alt="" src="{0}2:url" '
            '/></a>'.format(t.uid))
    assert result == expect