Browse Source

Fix assorted bugs in the Tag node.

tags/v0.3
Ben Kurtovic 10 years ago
parent
commit
77c4df701b
3 changed files with 8 additions and 4 deletions
  1. +1
    -1
      mwparserfromhell/nodes/extras/attribute.py
  2. +1
    -1
      mwparserfromhell/nodes/tag.py
  3. +6
    -2
      tests/_test_tree_equality.py

+ 1
- 1
mwparserfromhell/nodes/extras/attribute.py View File

@@ -36,7 +36,7 @@ class Attribute(StringMixIn):
whose value is ``"foo"``.
"""

def __init__(self, name, value=None, quoted=True, pad_first="",
def __init__(self, name, value=None, quoted=True, pad_first=" ",
pad_before_eq="", pad_after_eq=""):
super(Attribute, self).__init__()
self._name = name


+ 1
- 1
mwparserfromhell/nodes/tag.py View File

@@ -46,7 +46,7 @@ class Tag(Node):
self._padding = padding
if closing_tag:
self._closing_tag = closing_tag
elif not self_closing:
else:
self._closing_tag = tag

def __unicode__(self):


+ 6
- 2
tests/_test_tree_equality.py View File

@@ -102,10 +102,14 @@ class TreeEqualityTestCase(TestCase):
self.assertWikicodeEqual(exp_attr.name, act_attr.name)
if exp_attr.value is not None:
self.assertWikicodeEqual(exp_attr.value, act_attr.value)
self.assertIs(exp_attr.quoted, act_attr.quoted)
self.assertEqual(exp.attr.padding, act_attr.padding)
self.assertIs(exp_attr.quoted, act_attr.quoted)
self.assertEqual(exp_attr.pad_first, act_attr.pad_first)
self.assertEqual(exp_attr.pad_before_eq, act_attr.pad_before_eq)
self.assertEqual(exp_attr.pad_after_eq, act_attr.pad_after_eq)
self.assertIs(expected.showtag, actual.showtag)
self.assertIs(expected.self_closing, actual.self_closing)
self.assertIs(expected.invalid, actual.invalid)
self.assertIs(expected.implicit, actual.implicit)
self.assertEqual(expected.padding, actual.padding)
self.assertWikicodeEqual(expected.closing_tag, actual.closing_tag)



Loading…
Cancel
Save