Test that a nested `AtomicString` is not parsed.
(self)
| 691 | ) |
| 692 | |
| 693 | def testNestedAtomicString(self): |
| 694 | """ Test that a nested `AtomicString` is not parsed. """ |
| 695 | tree = etree.Element('div') |
| 696 | p = etree.SubElement(tree, 'p') |
| 697 | p.text = markdown.util.AtomicString('*some* ') |
| 698 | span1 = etree.SubElement(p, 'span') |
| 699 | span1.text = markdown.util.AtomicString('*more* ') |
| 700 | span2 = etree.SubElement(span1, 'span') |
| 701 | span2.text = markdown.util.AtomicString('*text* ') |
| 702 | span3 = etree.SubElement(span2, 'span') |
| 703 | span3.text = markdown.util.AtomicString('*here*') |
| 704 | span3.tail = markdown.util.AtomicString(' *to*') |
| 705 | span2.tail = markdown.util.AtomicString(' *test*') |
| 706 | span1.tail = markdown.util.AtomicString(' *with*') |
| 707 | new = self.inlineprocessor.run(tree) |
| 708 | self.assertEqual( |
| 709 | markdown.serializers.to_html_string(new), |
| 710 | '<div><p>*some* <span>*more* <span>*text* <span>*here*</span> ' |
| 711 | '*to*</span> *test*</span> *with*</p></div>' |
| 712 | ) |
| 713 | |
| 714 | def testInlineProcessorDoesntCrashWithWrongAtomicString(self): |
| 715 | """ Test that an `AtomicString` returned from a Pattern doesn't cause a crash. """ |