All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
build.test.test_parsers.test_rst.test_footnotes.py Maven / Gradle / Ivy
#! /usr/bin/env python
# $Id: test_footnotes.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger
# Copyright: This module has been placed in the public domain.
"""
Tests for states.py.
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.ParserTestSuite()
s.generateTests(totest)
return s
totest = {}
totest['footnotes'] = [
["""\
.. [1] This is a footnote.
""",
"""\
1
This is a footnote.
"""],
["""\
.. [1] This is a footnote
on multiple lines.
""",
"""\
1
This is a footnote
on multiple lines.
"""],
["""\
.. [1] This is a footnote
on multiple lines with more space.
.. [2] This is a footnote
on multiple lines with less space.
""",
"""\
1
This is a footnote
on multiple lines with more space.
2
This is a footnote
on multiple lines with less space.
"""],
["""\
.. [1]
This is a footnote on multiple lines
whose block starts on line 2.
""",
"""\
1
This is a footnote on multiple lines
whose block starts on line 2.
"""],
["""\
.. [1]
That was an empty footnote.
""",
"""\
1
That was an empty footnote.
"""],
["""\
.. [1]
No blank line.
""",
"""\
1
Explicit markup ends without a blank line; unexpected unindent.
No blank line.
"""],
]
totest['auto_numbered_footnotes'] = [
["""\
[#]_ is the first auto-numbered footnote reference.
[#]_ is the second auto-numbered footnote reference.
.. [#] Auto-numbered footnote 1.
.. [#] Auto-numbered footnote 2.
.. [#] Auto-numbered footnote 3.
[#]_ is the third auto-numbered footnote reference.
""",
"""\
is the first auto-numbered footnote reference.
is the second auto-numbered footnote reference.
Auto-numbered footnote 1.
Auto-numbered footnote 2.
Auto-numbered footnote 3.
is the third auto-numbered footnote reference.
"""],
["""\
[#third]_ is a reference to the third auto-numbered footnote.
.. [#first] First auto-numbered footnote.
.. [#second] Second auto-numbered footnote.
.. [#third] Third auto-numbered footnote.
[#second]_ is a reference to the second auto-numbered footnote.
[#first]_ is a reference to the first auto-numbered footnote.
[#third]_ is another reference to the third auto-numbered footnote.
Here are some internal cross-references to the targets generated by
the footnotes: first_, second_, third_.
""",
"""\
is a reference to the third auto-numbered footnote.
First auto-numbered footnote.
Second auto-numbered footnote.
Third auto-numbered footnote.
is a reference to the second auto-numbered footnote.
is a reference to the first auto-numbered footnote.
is another reference to the third auto-numbered footnote.
Here are some internal cross-references to the targets generated by
the footnotes: \n\
first
, \n\
second
, \n\
third
.
"""],
["""\
Mixed anonymous and labelled auto-numbered footnotes:
[#four]_ should be 4, [#]_ should be 1,
[#]_ should be 3, [#]_ is one too many,
[#two]_ should be 2, and [#six]_ doesn't exist.
.. [#] Auto-numbered footnote 1.
.. [#two] Auto-numbered footnote 2.
.. [#] Auto-numbered footnote 3.
.. [#four] Auto-numbered footnote 4.
.. [#five] Auto-numbered footnote 5.
.. [#five] Auto-numbered footnote 5 again (duplicate).
""",
"""\
Mixed anonymous and labelled auto-numbered footnotes:
should be 4, \n\
should be 1,
should be 3, \n\
is one too many,
should be 2, and \n\
doesn't exist.
Auto-numbered footnote 1.
Auto-numbered footnote 2.
Auto-numbered footnote 3.
Auto-numbered footnote 4.
Auto-numbered footnote 5.
Duplicate explicit target name: "five".
Auto-numbered footnote 5 again (duplicate).
"""],
["""\
Mixed manually-numbered, anonymous auto-numbered,
and labelled auto-numbered footnotes:
[#four]_ should be 4, [#]_ should be 2,
[1]_ is 1, [3]_ is 3,
[#]_ should be 6, [#]_ is one too many,
[#five]_ should be 5, and [#six]_ doesn't exist.
.. [1] Manually-numbered footnote 1.
.. [#] Auto-numbered footnote 2.
.. [#four] Auto-numbered footnote 4.
.. [3] Manually-numbered footnote 3
.. [#five] Auto-numbered footnote 5.
.. [#five] Auto-numbered footnote 5 again (duplicate).
.. [#] Auto-numbered footnote 6.
""",
"""\
Mixed manually-numbered, anonymous auto-numbered,
and labelled auto-numbered footnotes:
should be 4, \n\
should be 2,
1
is 1, \n\
3
is 3,
should be 6, \n\
is one too many,
should be 5, and \n\
doesn't exist.
1
Manually-numbered footnote 1.
Auto-numbered footnote 2.
Auto-numbered footnote 4.
3
Manually-numbered footnote 3
Auto-numbered footnote 5.
Duplicate explicit target name: "five".
Auto-numbered footnote 5 again (duplicate).
Auto-numbered footnote 6.
"""],
]
totest['auto_symbol_footnotes'] = [
["""\
.. [*] This is an auto-symbol footnote.
""",
"""\
This is an auto-symbol footnote.
"""],
]
if __name__ == '__main__':
import unittest
unittest.main(defaultTest='suite')