Browse Source

Implement the remaining asserts in TreeEqualityTestCase.

tags/v0.2
Ben Kurtovic 11 years ago
parent
commit
404b4479a2
3 changed files with 18 additions and 6 deletions
  1. +4
    -1
      mwparserfromhell/nodes/html_entity.py
  2. +13
    -5
      tests/_test_tree_equality.py
  3. +1
    -0
      tests/test_builder.py

+ 4
- 1
mwparserfromhell/nodes/html_entity.py View File

@@ -135,7 +135,10 @@ class HTMLEntity(Node):

@hex_char.setter
def hex_char(self, newval):
self._hex_char = bool(newval)
newval = str(newval)
if newval not in ("x", "X"):
raise ValueError(newval)
self._hex_char = newval

def normalize(self):
"""Return the unicode character represented by the HTML entity."""


+ 13
- 5
tests/_test_tree_equality.py View File

@@ -54,23 +54,31 @@ class TreeEqualityTestCase(TestCase):

def assertArgumentNodeEqual(self, expected, actual):
"""Assert that two Argument nodes have the same data."""
pass
self.assertWikicodeEqual(expected.name, actual.name)
if expected.default is not None:
self.assertWikicodeEqual(expected.default, actual.default)
else:
self.assertIs(None, actual.default)

def assertCommentNodeEqual(self, expected, actual):
"""Assert that two Comment nodes have the same data."""
pass
self.assertWikicodeEqual(expected.contents, actual.contents)

def assertHeadingNodeEqual(self, expected, actual):
"""Assert that two Heading nodes have the same data."""
pass
self.assertWikicodeEqual(expected.title, actual.title)
self.assertEqual(expected.level, actual.level)

def assertHTMLEntityNodeEqual(self, expected, actual):
"""Assert that two HTMLEntity nodes have the same data."""
pass
self.assertEqual(expected.value, actual.value)
self.assertIs(expected.named, actual.named)
self.assertIs(expected.hexadecimal, actual.hexadecimal)
self.assertEquals(expected.hex_char, actual.hex_char)

def assertTagNodeEqual(self, expected, actual):
"""Assert that two Tag nodes have the same data."""
pass
self.fail("Holding this until feature/html_tags is ready.")

def assertTemplateNodeEqual(self, expected, actual):
"""Assert that two Template nodes have the same data."""


+ 1
- 0
tests/test_builder.py View File

@@ -64,6 +64,7 @@ class TestBuilder(TreeEqualityTestCase):
"""tests for building Comment nodes"""
pass

@unittest.skip("holding this until feature/html_tags is ready")
def test_tag(self):
"""tests for building Tag nodes"""
pass


Loading…
Cancel
Save