@@ -26,8 +26,12 @@ from unittest import TestCase | |||||
from mwparserfromhell.nodes import (Argument, Comment, Heading, HTMLEntity, | from mwparserfromhell.nodes import (Argument, Comment, Heading, HTMLEntity, | ||||
Tag, Template, Text, Wikilink) | Tag, Template, Text, Wikilink) | ||||
from mwparserfromhell.nodes.extras import Attribute, Parameter | from mwparserfromhell.nodes.extras import Attribute, Parameter | ||||
from mwparserfromhell.smart_list import SmartList | |||||
from mwparserfromhell.wikicode import Wikicode | from mwparserfromhell.wikicode import Wikicode | ||||
wrap = lambda L: Wikicode(SmartList(L)) | |||||
wraptext = lambda t: wrap([Text(t)]) | |||||
class TreeEqualityTestCase(TestCase): | class TreeEqualityTestCase(TestCase): | ||||
"""A base test case with support for comparing the equality of node trees. | """A base test case with support for comparing the equality of node trees. | ||||
@@ -25,12 +25,8 @@ import unittest | |||||
from mwparserfromhell.compat import str | from mwparserfromhell.compat import str | ||||
from mwparserfromhell.nodes import Argument, Text | from mwparserfromhell.nodes import Argument, Text | ||||
from mwparserfromhell.smart_list import SmartList | |||||
from mwparserfromhell.wikicode import Wikicode | |||||
from ._test_tree_equality import TreeEqualityTestCase | |||||
wrap = lambda L: Wikicode(SmartList(L)) | |||||
from ._test_tree_equality import TreeEqualityTestCase, wrap | |||||
class TestArgument(TreeEqualityTestCase): | class TestArgument(TreeEqualityTestCase): | ||||
"""Test cases for the Argument node.""" | """Test cases for the Argument node.""" | ||||
@@ -28,12 +28,8 @@ from mwparserfromhell.nodes import (Argument, Comment, Heading, HTMLEntity, | |||||
from mwparserfromhell.nodes.extras import Attribute, Parameter | from mwparserfromhell.nodes.extras import Attribute, Parameter | ||||
from mwparserfromhell.parser import tokens | from mwparserfromhell.parser import tokens | ||||
from mwparserfromhell.parser.builder import Builder | from mwparserfromhell.parser.builder import Builder | ||||
from mwparserfromhell.smart_list import SmartList | |||||
from mwparserfromhell.wikicode import Wikicode | |||||
from ._test_tree_equality import TreeEqualityTestCase | |||||
wrap = lambda L: Wikicode(SmartList(L)) | |||||
from ._test_tree_equality import TreeEqualityTestCase, wrap | |||||
class TestBuilder(TreeEqualityTestCase): | class TestBuilder(TreeEqualityTestCase): | ||||
"""Tests for the builder, which turns tokens into Wikicode objects.""" | """Tests for the builder, which turns tokens into Wikicode objects.""" | ||||
@@ -25,12 +25,8 @@ import unittest | |||||
from mwparserfromhell.compat import str | from mwparserfromhell.compat import str | ||||
from mwparserfromhell.nodes import Heading, Text | from mwparserfromhell.nodes import Heading, Text | ||||
from mwparserfromhell.smart_list import SmartList | |||||
from mwparserfromhell.wikicode import Wikicode | |||||
from ._test_tree_equality import TreeEqualityTestCase | |||||
wrap = lambda L: Wikicode(SmartList(L)) | |||||
from ._test_tree_equality import TreeEqualityTestCase, wrap | |||||
class TestHeading(TreeEqualityTestCase): | class TestHeading(TreeEqualityTestCase): | ||||
"""Test cases for the Heading node.""" | """Test cases for the Heading node.""" | ||||
@@ -25,12 +25,8 @@ import unittest | |||||
from mwparserfromhell.compat import str | from mwparserfromhell.compat import str | ||||
from mwparserfromhell.nodes import HTMLEntity | from mwparserfromhell.nodes import HTMLEntity | ||||
from mwparserfromhell.smart_list import SmartList | |||||
from mwparserfromhell.wikicode import Wikicode | |||||
from ._test_tree_equality import TreeEqualityTestCase | |||||
wrap = lambda L: Wikicode(SmartList(L)) | |||||
from ._test_tree_equality import TreeEqualityTestCase, wrap | |||||
class TestHTMLEntity(TreeEqualityTestCase): | class TestHTMLEntity(TreeEqualityTestCase): | ||||
"""Test cases for the HTMLEntity node.""" | """Test cases for the HTMLEntity node.""" | ||||
@@ -26,12 +26,8 @@ import unittest | |||||
from mwparserfromhell.compat import str | from mwparserfromhell.compat import str | ||||
from mwparserfromhell.nodes import Text | from mwparserfromhell.nodes import Text | ||||
from mwparserfromhell.nodes.extras import Parameter | from mwparserfromhell.nodes.extras import Parameter | ||||
from mwparserfromhell.smart_list import SmartList | |||||
from mwparserfromhell.wikicode import Wikicode | |||||
from ._test_tree_equality import TreeEqualityTestCase | |||||
wrap = lambda L: Wikicode(SmartList(L)) | |||||
from ._test_tree_equality import TreeEqualityTestCase, wrap | |||||
class TestParameter(TreeEqualityTestCase): | class TestParameter(TreeEqualityTestCase): | ||||
"""Test cases for the Parameter node extra.""" | """Test cases for the Parameter node extra.""" | ||||
@@ -26,12 +26,8 @@ import unittest | |||||
from mwparserfromhell.compat import str | from mwparserfromhell.compat import str | ||||
from mwparserfromhell.nodes import HTMLEntity, Template, Text | from mwparserfromhell.nodes import HTMLEntity, Template, Text | ||||
from mwparserfromhell.nodes.extras import Parameter | from mwparserfromhell.nodes.extras import Parameter | ||||
from mwparserfromhell.smart_list import SmartList | |||||
from mwparserfromhell.wikicode import Wikicode | |||||
from ._test_tree_equality import TreeEqualityTestCase | |||||
from ._test_tree_equality import TreeEqualityTestCase, wrap, wraptext | |||||
wrap = lambda L: Wikicode(SmartList(L)) | |||||
wraptext = lambda t: wrap([Text(t)]) | |||||
pgens = lambda k, v: Parameter(wraptext(k), wraptext(v), showkey=True) | pgens = lambda k, v: Parameter(wraptext(k), wraptext(v), showkey=True) | ||||
pgenh = lambda k, v: Parameter(wraptext(k), wraptext(v), showkey=False) | pgenh = lambda k, v: Parameter(wraptext(k), wraptext(v), showkey=False) | ||||
@@ -25,12 +25,8 @@ import unittest | |||||
from mwparserfromhell.compat import str | from mwparserfromhell.compat import str | ||||
from mwparserfromhell.nodes import Text, Wikilink | from mwparserfromhell.nodes import Text, Wikilink | ||||
from mwparserfromhell.smart_list import SmartList | |||||
from mwparserfromhell.wikicode import Wikicode | |||||
from ._test_tree_equality import TreeEqualityTestCase | |||||
wrap = lambda L: Wikicode(SmartList(L)) | |||||
from ._test_tree_equality import TreeEqualityTestCase, wrap | |||||
class TestWikilink(TreeEqualityTestCase): | class TestWikilink(TreeEqualityTestCase): | ||||
"""Test cases for the Wikilink node.""" | """Test cases for the Wikilink node.""" | ||||