Ver código fonte

test_wikilink(); fix indentation

tags/v0.2
Ben Kurtovic 11 anos atrás
pai
commit
7289d8c070
1 arquivos alterados com 27 adições e 5 exclusões
  1. +27
    -5
      tests/test_builder.py

+ 27
- 5
tests/test_builder.py Ver arquivo

@@ -68,7 +68,7 @@ class TestBuilder(TreeEqualityTestCase):
tokens.TemplateClose()], tokens.TemplateClose()],
wrap([Template(wrap([Text("foo")]), params=[ wrap([Template(wrap([Text("foo")]), params=[
Parameter(wrap([Text("1")]), wrap([Text("bar")]), Parameter(wrap([Text("1")]), wrap([Text("bar")]),
showkey=False)])])),
showkey=False)])])),


([tokens.TemplateOpen(), tokens.Text(text="foo"), ([tokens.TemplateOpen(), tokens.Text(text="foo"),
tokens.TemplateParamSeparator(), tokens.Text(text="bar"), tokens.TemplateParamSeparator(), tokens.Text(text="bar"),
@@ -89,12 +89,12 @@ class TestBuilder(TreeEqualityTestCase):
wrap([Template(wrap([Text("foo")]), params=[ wrap([Template(wrap([Text("foo")]), params=[
Parameter(wrap([Text("bar")]), wrap([Text("baz")])), Parameter(wrap([Text("bar")]), wrap([Text("baz")])),
Parameter(wrap([Text("1")]), wrap([Text("biz")]), Parameter(wrap([Text("1")]), wrap([Text("biz")]),
showkey=False),
showkey=False),
Parameter(wrap([Text("2")]), wrap([Text("buzz")]), Parameter(wrap([Text("2")]), wrap([Text("buzz")]),
showkey=False),
showkey=False),
Parameter(wrap([Text("3")]), wrap([Text("buff")])), Parameter(wrap([Text("3")]), wrap([Text("buff")])),
Parameter(wrap([Text("3")]), wrap([Text("baff")]), Parameter(wrap([Text("3")]), wrap([Text("baff")]),
showkey=False)])])),
showkey=False)])])),
] ]
for test, valid in tests: for test, valid in tests:
self.assertWikicodeEqual(valid, self.builder.build(test)) self.assertWikicodeEqual(valid, self.builder.build(test))
@@ -127,7 +127,29 @@ class TestBuilder(TreeEqualityTestCase):


def test_wikilink(self): def test_wikilink(self):
"""tests for building Wikilink nodes""" """tests for building Wikilink nodes"""
pass
tests = [
([tokens.WikilinkOpen(), tokens.Text(text="foobar"),
tokens.WikilinkClose()],
wrap([Wikilink(wrap([Text("foobar")]))])),

([tokens.WikilinkOpen(), tokens.Text(text="spam"),
tokens.Text(text="eggs"), tokens.WikilinkClose()],
wrap([Wikilink(wrap([Text("spam"), Text("eggs")]))])),

([tokens.WikilinkOpen(), tokens.Text(text="foo"),
tokens.WikilinkSeparator(), tokens.Text(text="bar"),
tokens.WikilinkClose()],
wrap([Wikilink(wrap([Text("foo")]), wrap([Text("bar")]))])),

([tokens.WikilinkOpen(), tokens.Text(text="foo"),
tokens.Text(text="bar"), tokens.WikilinkSeparator(),
tokens.Text(text="baz"), tokens.Text(text="biz"),
tokens.WikilinkClose()],
wrap([Wikilink(wrap([Text("foo"), Text("bar")]),
wrap([Text("baz"), Text("biz")]))])),
]
for test, valid in tests:
self.assertWikicodeEqual(valid, self.builder.build(test))


def test_html_entity(self): def test_html_entity(self):
"""tests for building HTMLEntity nodes""" """tests for building HTMLEntity nodes"""


Carregando…
Cancelar
Salvar