Browse Source

Move wrap() and wraptext() TO _test_tree_equality.

tags/v0.2
Ben Kurtovic 11 years ago
parent
commit
7853e20745
8 changed files with 11 additions and 35 deletions
  1. +4
    -0
      tests/_test_tree_equality.py
  2. +1
    -5
      tests/test_argument.py
  3. +1
    -5
      tests/test_builder.py
  4. +1
    -5
      tests/test_heading.py
  5. +1
    -5
      tests/test_html_entity.py
  6. +1
    -5
      tests/test_parameter.py
  7. +1
    -5
      tests/test_template.py
  8. +1
    -5
      tests/test_wikilink.py

+ 4
- 0
tests/_test_tree_equality.py View File

@@ -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.




+ 1
- 5
tests/test_argument.py View File

@@ -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."""


+ 1
- 5
tests/test_builder.py View File

@@ -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."""


+ 1
- 5
tests/test_heading.py View File

@@ -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."""


+ 1
- 5
tests/test_html_entity.py View File

@@ -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."""


+ 1
- 5
tests/test_parameter.py View File

@@ -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."""


+ 1
- 5
tests/test_template.py View File

@@ -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)




+ 1
- 5
tests/test_wikilink.py View File

@@ -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."""


Loading…
Cancel
Save