예제 #1
0
 def test_use_c(self):
     """make sure the correct tokenizer is used"""
     restore = parser.use_c
     if parser.use_c:
         self.assertTrue(parser.Parser()._tokenizer.USES_C)
         parser.use_c = False
     self.assertFalse(parser.Parser()._tokenizer.USES_C)
     parser.use_c = restore
예제 #2
0
 def test_parsing(self):
     """integration test for parsing overall"""
     text = "this is text; {{this|is=a|template={{with|[[links]]|in}}it}}"
     expected = wrap([
         Text("this is text; "),
         Template(wraptext("this"), [
             Parameter(wraptext("is"), wraptext("a")),
             Parameter(wraptext("template"), wrap([
                 Template(wraptext("with"), [
                     Parameter(wraptext("1"),
                               wrap([Wikilink(wraptext("links"))]),
                               showkey=False),
                     Parameter(wraptext("2"),
                               wraptext("in"), showkey=False)
                 ]),
                 Text("it")
             ]))
         ])
     ])
     actual = parser.Parser().parse(text)
     self.assertWikicodeEqual(expected, actual)
예제 #3
0
 def test():
     with_style = parser.Parser().parse(text, skip_style_tags=False)
     without_style = parser.Parser().parse(text, skip_style_tags=True)
     self.assertWikicodeEqual(a, with_style)
     self.assertWikicodeEqual(b, without_style)