def test_invalid_nested_wikilinks_in_ref(self): self.assertEqual( { 'Parameter': [], 'ParserFunction': [], 'Template': [], 'WikiLink': [[0, 13]], 'Comment': [], 'ExtTag': [] }, parse_to_spans(bytearray(b'[[L| [[S]] ]]')))
def test_single_brace_after_pf_remove(self): self.assertEqual( { 'Parameter': [], 'ParserFunction': [[4, 17]], 'Template': [[1, 21]], 'WikiLink': [], 'Comment': [], 'ExtTag': [] }, parse_to_spans(bytearray(b'{{{ {{#if:v|y|n}}} }}')))
def test_invalid_nested_wikilinks(self): self.assertEqual( { 'Parameter': [], 'ParserFunction': [], 'Template': [], 'WikiLink': [[10, 15]], 'Comment': [], 'ExtTag': [[0, 24]] }, parse_to_spans(bytearray(b'<ref>[[L| [[S]] ]]</ref>')))
def test_nested_wikilinks_in_ref(self): self.assertEqual( { 'Parameter': [], 'ParserFunction': [], 'Template': [], 'WikiLink': [[30, 38], [5, 40]], 'Comment': [], 'ExtTag': [[0, 46]] }, parse_to_spans( bytearray(b'<ref>[[File:Example.jpg|thumb|[[Link]]]]</ref>')))
def test_nested_param_semiparser(self): self.assertEqual( [[1, 14]], parse_to_spans(bytearray(b'{{{#if:v|y|n}}}'))['ParserFunction'], )
def test_parse_inner_contents_of_wikilink_inside_ref(self): self.assertEqual( [[7, 20]], parse_to_spans( bytearray(b'<ref>[[{{text|link}}]]</ref>'))['Template'], )
def test_single_brace_after_first_tl_removal(self): self.assertEqual( [[7, 16], [0, 20]], parse_to_spans(bytearray(b'{{text|{{text|}}} }}'))['Template'], )
def test_single_brace_in_tl(self): self.assertEqual( [[0, 12]], parse_to_spans(bytearray(b'{{text|i}n}}'))['Template'], )