Exemplo n.º 1
0
 def test_not_reference(self):
     """This is a_trap for the ``__parser__``."""
     data = u"""This is a_trap for the ``__parser__``."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This is a_trap for the '))
     self.assertEqual(events[1], (XLITERAL, u'__parser__'))
     self.assertEqual(events[2], (XTEXT, u'.'))
Exemplo n.º 2
0
 def test_interpreted(self):
     """This `word` is interpreted."""
     data = u"""This `word` is interpreted."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This '))
     self.assertEqual(events[1], (XINTERPRETED, u'word'))
     self.assertEqual(events[2], (XTEXT, u' is interpreted.'))
Exemplo n.º 3
0
 def test_reference_simple(self):
     """This word_ is a reference to a target."""
     data = u"""This word_ is a reference to a target."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This '))
     self.assertEqual(events[1], (XREFERENCE, u'word'))
     self.assertEqual(events[2], (XTEXT, u' is a reference to a target.'))
Exemplo n.º 4
0
 def test_emphasis(self):
     """This text *contains* emphasis."""
     data = u"""This text *contains* emphasis."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This text '))
     self.assertEqual(events[1], (XEMPHASIS, u'contains'))
     self.assertEqual(events[2], (XTEXT, u' emphasis.'))
Exemplo n.º 5
0
 def test_target_inline(self):
     """I am a _`inline target`."""
     data = u"""I am a _`inline target`."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'I am a '))
     self.assertEqual(events[1], (XTARGET, u'inline target'))
     self.assertEqual(events[2], (XTEXT, u'.'))
Exemplo n.º 6
0
 def test_target_inline(self):
     """I am a _`inline target`."""
     data = u"""I am a _`inline target`."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'I am a '))
     self.assertEqual(events[1], (XTARGET, u'inline target'))
     self.assertEqual(events[2], (XTEXT, u'.'))
Exemplo n.º 7
0
 def test_reference_substitution(self):
     """Introducing the |substitution|!"""
     data = u"""Introducing the |substitution|!"""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'Introducing the '))
     self.assertEqual(events[1], (XSUBSTITUTION, u'substitution'))
     self.assertEqual(events[2], (XTEXT, u'!'))
Exemplo n.º 8
0
 def test_reference_citation(self):
     """See the citation [CIT2002]_."""
     data = u"""See the citation [CIT2002]_."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'See the citation '))
     self.assertEqual(events[1], (XCITATION, u'CIT2002'))
     self.assertEqual(events[2], (XTEXT, u'.'))
Exemplo n.º 9
0
 def test_emphasis(self):
     """This text *contains* emphasis."""
     data = u"""This text *contains* emphasis."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This text '))
     self.assertEqual(events[1], (XEMPHASIS, u'contains'))
     self.assertEqual(events[2], (XTEXT, u' emphasis.'))
Exemplo n.º 10
0
 def test_interpreted(self):
     """This `word` is interpreted."""
     data = u"""This `word` is interpreted."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This '))
     self.assertEqual(events[1], (XINTERPRETED, u'word'))
     self.assertEqual(events[2], (XTEXT, u' is interpreted.'))
Exemplo n.º 11
0
 def test_reference_footnote(self):
     """See the footnote[1]_."""
     data = u"""See the footnote[1]_."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'See the footnote'))
     self.assertEqual(events[1], (XFOOTNOTE, u'1'))
     self.assertEqual(events[2], (XTEXT, u'.'))
Exemplo n.º 12
0
 def test_inline_literal(self):
     """This ``word`` is inline literal."""
     data = u"""This ``word`` is inline literal."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This '))
     self.assertEqual(events[1], (XLITERAL, u'word'))
     self.assertEqual(events[2], (XTEXT, u' is inline literal.'))
Exemplo n.º 13
0
 def test_not_reference(self):
     """This is a_trap for the ``__parser__``."""
     data = u"""This is a_trap for the ``__parser__``."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This is a_trap for the '))
     self.assertEqual(events[1], (XLITERAL, u'__parser__'))
     self.assertEqual(events[2], (XTEXT, u'.'))
Exemplo n.º 14
0
 def test_reference_substitution(self):
     """Introducing the |substitution|!"""
     data = u"""Introducing the |substitution|!"""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'Introducing the '))
     self.assertEqual(events[1], (XSUBSTITUTION, u'substitution'))
     self.assertEqual(events[2], (XTEXT, u'!'))
Exemplo n.º 15
0
 def test_reference_simple(self):
     """This word_ is a reference to a target."""
     data = u"""This word_ is a reference to a target."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This '))
     self.assertEqual(events[1], (XREFERENCE, u'word'))
     self.assertEqual(events[2], (XTEXT, u' is a reference to a target.'))
Exemplo n.º 16
0
 def test_reference_quoted(self):
     """This `couple of words`_ is a reference too."""
     data = u"""This `couple of words`_ is a reference too."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This '))
     self.assertEqual(events[1], (XREFERENCE, u'couple of words'))
     self.assertEqual(events[2], (XTEXT, u' is a reference too.'))
Exemplo n.º 17
0
 def test_reference_footnote(self):
     """See the footnote[1]_."""
     data = u"""See the footnote[1]_."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'See the footnote'))
     self.assertEqual(events[1], (XFOOTNOTE, u'1'))
     self.assertEqual(events[2], (XTEXT, u'.'))
Exemplo n.º 18
0
 def test_reference_quoted(self):
     """This `couple of words`_ is a reference too."""
     data = u"""This `couple of words`_ is a reference too."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This '))
     self.assertEqual(events[1], (XREFERENCE, u'couple of words'))
     self.assertEqual(events[2], (XTEXT, u' is a reference too.'))
Exemplo n.º 19
0
 def test_inline_literal(self):
     """This ``word`` is inline literal."""
     data = u"""This ``word`` is inline literal."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This '))
     self.assertEqual(events[1], (XLITERAL, u'word'))
     self.assertEqual(events[2], (XTEXT, u' is inline literal.'))
Exemplo n.º 20
0
 def test_reference_citation(self):
     """See the citation [CIT2002]_."""
     data = u"""See the citation [CIT2002]_."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'See the citation '))
     self.assertEqual(events[1], (XCITATION, u'CIT2002'))
     self.assertEqual(events[2], (XTEXT, u'.'))
Exemplo n.º 21
0
 def test_emphasis_strong(self):
     """This text *contains* **strong** emphasis."""
     data = u"""This text *contains* **strong** emphasis."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This text '))
     self.assertEqual(events[1], (XEMPHASIS, u'contains'))
     self.assertEqual(events[2], (XTEXT, u' '))
     self.assertEqual(events[3], (XSTRONG, u'strong'))
     self.assertEqual(events[4], (XTEXT, u' emphasis.'))
Exemplo n.º 22
0
 def test_emphasis_strong(self):
     """This text *contains* **strong** emphasis."""
     data = u"""This text *contains* **strong** emphasis."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'This text '))
     self.assertEqual(events[1], (XEMPHASIS, u'contains'))
     self.assertEqual(events[2], (XTEXT, u' '))
     self.assertEqual(events[3], (XSTRONG, u'strong'))
     self.assertEqual(events[4], (XTEXT, u' emphasis.'))
Exemplo n.º 23
0
 def test_fake_footnote(self):
     """I look like a footnote[1]."""
     data = u"""I look like a footnote[1]."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'I look like a footnote'))
     self.assertEqual(events[1], (XTEXT, u'[1].'))
Exemplo n.º 24
0
 def test_bytestring(self):
     """I am a bytestring, not text."""
     data = """I am a bytestring, not text."""
     self.assertRaises(TypeError, parse_inline(data))
Exemplo n.º 25
0
 def test_text(self):
     """I am a regular text."""
     data = u"""I am a regular text."""
     events = parse_inline(data).next()
     self.assertEqual(events, (XTEXT, u'I am a regular text.'))
Exemplo n.º 26
0
 def test_bytestring(self):
     """I am a bytestring, not text."""
     data = """I am a bytestring, not text."""
     self.assertRaises(TypeError, parse_inline(data))
Exemplo n.º 27
0
 def test_text(self):
     """I am a regular text."""
     data = u"""I am a regular text."""
     events = parse_inline(data).next()
     self.assertEqual(events, (XTEXT, u'I am a regular text.'))
Exemplo n.º 28
0
 def test_fake_footnote(self):
     """I look like a footnote[1]."""
     data = u"""I look like a footnote[1]."""
     events = list(parse_inline(data))
     self.assertEqual(events[0], (XTEXT, u'I look like a footnote'))
     self.assertEqual(events[1], (XTEXT, u'[1].'))