From 7289d8c070a6fcd2bceaa8e00e7661c9c21461a5 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 5 Apr 2013 10:25:48 -0400 Subject: [PATCH] test_wikilink(); fix indentation --- tests/test_builder.py | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/tests/test_builder.py b/tests/test_builder.py index e632644..ea38dae 100644 --- a/tests/test_builder.py +++ b/tests/test_builder.py @@ -68,7 +68,7 @@ class TestBuilder(TreeEqualityTestCase): tokens.TemplateClose()], wrap([Template(wrap([Text("foo")]), params=[ Parameter(wrap([Text("1")]), wrap([Text("bar")]), - showkey=False)])])), + showkey=False)])])), ([tokens.TemplateOpen(), tokens.Text(text="foo"), tokens.TemplateParamSeparator(), tokens.Text(text="bar"), @@ -89,12 +89,12 @@ class TestBuilder(TreeEqualityTestCase): wrap([Template(wrap([Text("foo")]), params=[ Parameter(wrap([Text("bar")]), wrap([Text("baz")])), Parameter(wrap([Text("1")]), wrap([Text("biz")]), - showkey=False), + showkey=False), Parameter(wrap([Text("2")]), wrap([Text("buzz")]), - showkey=False), + showkey=False), Parameter(wrap([Text("3")]), wrap([Text("buff")])), Parameter(wrap([Text("3")]), wrap([Text("baff")]), - showkey=False)])])), + showkey=False)])])), ] for test, valid in tests: self.assertWikicodeEqual(valid, self.builder.build(test)) @@ -127,7 +127,29 @@ class TestBuilder(TreeEqualityTestCase): def test_wikilink(self): """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): """tests for building HTMLEntity nodes"""