forked from sebix/python-textile
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a83b7d
commit 9e604c0
Showing
3 changed files
with
21 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
from textile import Textile | ||
from textile.objects.list import List | ||
|
||
|
||
def test_lists(): | ||
t = Textile() | ||
result = t.textileLists("* one\n* two\n* three") | ||
expect = '\t<ul>\n\t\t<li>one</li>\n\t\t<li>two</li>\n\t\t<li>three</li>\n\t</ul>' | ||
assert result == expect | ||
|
||
|
||
def test_nested_list(): | ||
l = List('ol', indent_level=1) | ||
l.add_item('li', 'test') | ||
lst = List('ol', indent_level=1) | ||
lst('li', 'test') | ||
s = List('ol', indent_level=2) | ||
s.add_item('li', 'another one') | ||
l.add_item('li', s) | ||
result = l.process() | ||
lst('li', s) | ||
result = lst() | ||
expect = '\t<ol>\n\t\t<li>test\n\t\t<ol>\n\t\t\t<li>another one</li>\n\t\t</ol></li>\n\t</ol>' | ||
assert result == expect | ||
|
||
l = List('ol', indent_level=1) | ||
l.add_item('li', 'test') | ||
lst = List('ol', indent_level=1) | ||
lst('li', 'test') | ||
s1 = List('ol', indent_level=2) | ||
s1.add_item('li', 'another one') | ||
s2 = List('ul', indent_level=3) | ||
s2.add_item('li', 'point one') | ||
s2.add_item('li', 'point two') | ||
s1.add_item('li', s2) | ||
s1.add_item('li', 'moar item') | ||
l.add_item('li', s1) | ||
result = l.process() | ||
lst('li', s1) | ||
result = lst() | ||
expect = '\t<ol>\n\t\t<li>test\n\t\t<ol>\n\t\t\t<li>another one\n\t\t\t<ul>\n\t\t\t\t<li>point one</li>\n\t\t\t\t<li>point two</li>\n\t\t\t</ul></li>\n\t\t\t<li>moar item</li>\n\t\t</ol></li>\n\t</ol>' | ||
assert result == expect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters