Bladeren bron

Add test code for a missing branch of Tag.wiki_markup.setter; cleanup.

tags/v0.4
Ben Kurtovic 10 jaren geleden
bovenliggende
commit
504b8bace0
2 gewijzigde bestanden met toevoegingen van 4 en 1 verwijderingen
  1. +1
    -1
      mwparserfromhell/nodes/tag.py
  2. +3
    -0
      tests/test_tag.py

+ 1
- 1
mwparserfromhell/nodes/tag.py Bestand weergeven

@@ -223,7 +223,7 @@ class Tag(Node):
def wiki_markup(self, value): def wiki_markup(self, value):
self._wiki_markup = str(value) if value else None self._wiki_markup = str(value) if value else None
if not value or not self.closing_wiki_markup: if not value or not self.closing_wiki_markup:
self.closing_wiki_markup = str(value) if value else None
self._closing_wiki_markup = self._wiki_markup


@self_closing.setter @self_closing.setter
def self_closing(self, value): def self_closing(self, value):


+ 3
- 0
tests/test_tag.py Bestand weergeven

@@ -246,6 +246,9 @@ class TestTag(TreeEqualityTestCase):
node.closing_wiki_markup = "|}" node.closing_wiki_markup = "|}"
self.assertEqual("|}", node.closing_wiki_markup) self.assertEqual("|}", node.closing_wiki_markup)
self.assertEqual("{|\n|}", node) self.assertEqual("{|\n|}", node)
node.wiki_markup = "!!"
self.assertEqual("|}", node.closing_wiki_markup)
self.assertEqual("!!\n|}", node)
node.wiki_markup = False node.wiki_markup = False
self.assertFalse(node.closing_wiki_markup) self.assertFalse(node.closing_wiki_markup)
self.assertEqual("<table>\n</table>", node) self.assertEqual("<table>\n</table>", node)


Laden…
Annuleren
Opslaan