Ver código fonte

Fix a couple bugs.

tags/v0.2
Ben Kurtovic 11 anos atrás
pai
commit
35acc1b812
2 arquivos alterados com 3 adições e 3 exclusões
  1. +1
    -1
      mwparserfromhell/wikicode.py
  2. +2
    -2
      tests/test_wikicode.py

+ 1
- 1
mwparserfromhell/wikicode.py Ver arquivo

@@ -370,7 +370,7 @@ class Wikicode(StringMixIn):
if self.nodes[i] in headings:
this = self.nodes[i].level
for (level, start) in buffers:
if not flat or this <= level:
if this <= level:
buffers.remove((level, start))
sections.append(Wikicode(self.nodes[start:i]))
buffers.append((this, i))


+ 2
- 2
tests/test_wikicode.py Ver arquivo

@@ -305,8 +305,8 @@ Even more text.
An invalid section!"""

self.assertEqual([], parse(page1).get_sections())
self.assertEqual(["==Heading=="], parse(page2).get_sections())
self.assertEqual(["===Heading===\nFoo bar baz\n", "====Gnidaeh====\n"], parse(page2).get_sections())
self.assertEqual(["", "==Heading=="], parse(page2).get_sections())
self.assertEqual(["", "===Heading===\nFoo bar baz\n====Gnidaeh====\n", "====Gnidaeh====\n"], parse(page3).get_sections())

def test_strip_code(self):
"""test Wikicode.strip_code()"""


Carregando…
Cancelar
Salvar