summaryrefslogtreecommitdiff
path: root/docutils/test/test_transforms/test_footnotes.py
diff options
context:
space:
mode:
Diffstat (limited to 'docutils/test/test_transforms/test_footnotes.py')
-rwxr-xr-xdocutils/test/test_transforms/test_footnotes.py520
1 files changed, 0 insertions, 520 deletions
diff --git a/docutils/test/test_transforms/test_footnotes.py b/docutils/test/test_transforms/test_footnotes.py
deleted file mode 100755
index 4da43e055..000000000
--- a/docutils/test/test_transforms/test_footnotes.py
+++ /dev/null
@@ -1,520 +0,0 @@
-#! /usr/bin/env python
-
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision$
-# Date: $Date$
-# Copyright: This module has been placed in the public domain.
-
-"""
-Tests for docutils.transforms.references.Footnotes.
-"""
-
-from __init__ import DocutilsTestSupport
-from docutils.transforms.references import Footnotes
-from docutils.parsers.rst import Parser
-
-
-def suite():
- parser = Parser()
- s = DocutilsTestSupport.TransformTestSuite(parser)
- s.generateTests(totest)
- return s
-
-totest = {}
-
-totest['footnotes'] = ((Footnotes,), [
-["""\
-[#autolabel]_
-
-.. [#autolabel] text
-""",
-"""\
-<document source="test data">
- <paragraph>
- <footnote_reference auto="1" id="id1" refid="autolabel">
- 1
- <footnote auto="1" backrefs="id1" id="autolabel" name="autolabel">
- <label>
- 1
- <paragraph>
- text
-"""],
-["""\
-autonumber: [#]_
-
-.. [#] text
-""",
-"""\
-<document source="test data">
- <paragraph>
- autonumber: \n\
- <footnote_reference auto="1" id="id1" refid="id2">
- 1
- <footnote auto="1" backrefs="id1" id="id2" name="1">
- <label>
- 1
- <paragraph>
- text
-"""],
-["""\
-[#]_ 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.
-""",
-"""\
-<document source="test data">
- <paragraph>
- <footnote_reference auto="1" id="id1" refid="id3">
- 1
- is the first auto-numbered footnote reference.
- <footnote_reference auto="1" id="id2" refid="id4">
- 2
- is the second auto-numbered footnote reference.
- <footnote auto="1" backrefs="id1" id="id3" name="1">
- <label>
- 1
- <paragraph>
- Auto-numbered footnote 1.
- <footnote auto="1" backrefs="id2" id="id4" name="2">
- <label>
- 2
- <paragraph>
- Auto-numbered footnote 2.
- <footnote auto="1" backrefs="id6" id="id5" name="3">
- <label>
- 3
- <paragraph>
- Auto-numbered footnote 3.
- <paragraph>
- <footnote_reference auto="1" id="id6" refid="id5">
- 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 implicit targets
-generated by the footnotes: first_, second_, third_.
-""",
-"""\
-<document source="test data">
- <paragraph>
- <footnote_reference auto="1" id="id1" refid="third">
- 3
- is a reference to the third auto-numbered footnote.
- <footnote auto="1" backrefs="id3" id="first" name="first">
- <label>
- 1
- <paragraph>
- First auto-numbered footnote.
- <footnote auto="1" backrefs="id2" id="second" name="second">
- <label>
- 2
- <paragraph>
- Second auto-numbered footnote.
- <footnote auto="1" backrefs="id1 id4" id="third" name="third">
- <label>
- 3
- <paragraph>
- Third auto-numbered footnote.
- <paragraph>
- <footnote_reference auto="1" id="id2" refid="second">
- 2
- is a reference to the second auto-numbered footnote.
- <footnote_reference auto="1" id="id3" refid="first">
- 1
- is a reference to the first auto-numbered footnote.
- <footnote_reference auto="1" id="id4" refid="third">
- 3
- is another reference to the third auto-numbered footnote.
- <paragraph>
- Here are some internal cross-references to the implicit targets
- generated by the footnotes: \n\
- <reference refname="first">
- first
- , \n\
- <reference refname="second">
- second
- , \n\
- <reference refname="third">
- 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).
-""",
-"""\
-<document source="test data">
- <paragraph>
- Mixed anonymous and labelled auto-numbered footnotes:
- <paragraph>
- <footnote_reference auto="1" id="id1" refid="four">
- 4
- should be 4, \n\
- <footnote_reference auto="1" id="id2" refid="id7">
- 1
- should be 1,
- <footnote_reference auto="1" id="id3" refid="id8">
- 3
- should be 3, \n\
- <problematic id="id11" refid="id10">
- [#]_
- is one too many,
- <footnote_reference auto="1" id="id5" refid="two">
- 2
- should be 2, and \n\
- <footnote_reference auto="1" id="id6" refname="six">
- doesn't exist.
- <footnote auto="1" backrefs="id2" id="id7" name="1">
- <label>
- 1
- <paragraph>
- Auto-numbered footnote 1.
- <footnote auto="1" backrefs="id5" id="two" name="two">
- <label>
- 2
- <paragraph>
- Auto-numbered footnote 2.
- <footnote auto="1" backrefs="id3" id="id8" name="3">
- <label>
- 3
- <paragraph>
- Auto-numbered footnote 3.
- <footnote auto="1" backrefs="id1" id="four" name="four">
- <label>
- 4
- <paragraph>
- Auto-numbered footnote 4.
- <footnote auto="1" dupname="five" id="five">
- <label>
- 5
- <paragraph>
- Auto-numbered footnote 5.
- <footnote auto="1" dupname="five" id="id9">
- <label>
- 6
- <system_message backrefs="id9" level="2" line="12" source="test data" type="WARNING">
- <paragraph>
- Duplicate explicit target name: "five".
- <paragraph>
- Auto-numbered footnote 5 again (duplicate).
- <system_message backrefs="id11" id="id10" level="3" line="3" source="test data" type="ERROR">
- <paragraph>
- Too many autonumbered footnote references: only 2 corresponding footnotes available.
-"""],
-["""\
-Mixed auto-numbered and manual footnotes:
-
-.. [1] manually numbered
-.. [#] auto-numbered
-.. [#label] autonumber-labeled
-""",
-"""\
-<document source="test data">
- <paragraph>
- Mixed auto-numbered and manual footnotes:
- <footnote id="id1" name="1">
- <label>
- 1
- <paragraph>
- manually numbered
- <footnote auto="1" id="id2" name="2">
- <label>
- 2
- <paragraph>
- auto-numbered
- <footnote auto="1" id="label" name="label">
- <label>
- 3
- <paragraph>
- autonumber-labeled
-"""],
-["""\
-A labeled autonumbered footnote referece: [#footnote]_.
-
-An unlabeled autonumbered footnote referece: [#]_.
-
-.. [#] Unlabeled autonumbered footnote.
-.. [#footnote] Labeled autonumbered footnote.
- Note that the footnotes are not in the same
- order as the references.
-""",
-"""\
-<document source="test data">
- <paragraph>
- A labeled autonumbered footnote referece: \n\
- <footnote_reference auto="1" id="id1" refid="footnote">
- 2
- .
- <paragraph>
- An unlabeled autonumbered footnote referece: \n\
- <footnote_reference auto="1" id="id2" refid="id3">
- 1
- .
- <footnote auto="1" backrefs="id2" id="id3" name="1">
- <label>
- 1
- <paragraph>
- Unlabeled autonumbered footnote.
- <footnote auto="1" backrefs="id1" id="footnote" name="footnote">
- <label>
- 2
- <paragraph>
- Labeled autonumbered footnote.
- Note that the footnotes are not in the same
- order as the references.
-"""],
-["""\
-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 [#eight]_ 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.
-.. [#] Auto-numbered footnote 6.
-.. [#five] Auto-numbered footnote 5 again (duplicate).
-""",
-"""\
-<document source="test data">
- <paragraph>
- Mixed manually-numbered, anonymous auto-numbered,
- and labelled auto-numbered footnotes:
- <paragraph>
- <footnote_reference auto="1" id="id1" refid="four">
- 4
- should be 4, \n\
- <footnote_reference auto="1" id="id2" refid="id10">
- 2
- should be 2,
- <footnote_reference id="id3" refid="id9">
- 1
- is 1, \n\
- <footnote_reference id="id4" refid="id11">
- 3
- is 3,
- <footnote_reference auto="1" id="id5" refid="id12">
- 6
- should be 6, \n\
- <problematic id="id15" refid="id14">
- [#]_
- is one too many,
- <footnote_reference auto="1" id="id7" refname="five">
- should be 5, and \n\
- <footnote_reference auto="1" id="id8" refname="eight">
- doesn't exist.
- <footnote backrefs="id3" id="id9" name="1">
- <label>
- 1
- <paragraph>
- Manually-numbered footnote 1.
- <footnote auto="1" backrefs="id2" id="id10" name="2">
- <label>
- 2
- <paragraph>
- Auto-numbered footnote 2.
- <footnote auto="1" backrefs="id1" id="four" name="four">
- <label>
- 4
- <paragraph>
- Auto-numbered footnote 4.
- <footnote backrefs="id4" id="id11" name="3">
- <label>
- 3
- <paragraph>
- Manually-numbered footnote 3
- <footnote auto="1" dupname="five" id="five">
- <label>
- 5
- <paragraph>
- Auto-numbered footnote 5.
- <footnote auto="1" backrefs="id5" id="id12" name="6">
- <label>
- 6
- <paragraph>
- Auto-numbered footnote 6.
- <footnote auto="1" dupname="five" id="id13">
- <label>
- 7
- <system_message backrefs="id13" level="2" line="15" source="test data" type="WARNING">
- <paragraph>
- Duplicate explicit target name: "five".
- <paragraph>
- Auto-numbered footnote 5 again (duplicate).
- <system_message backrefs="id15" id="id14" level="3" line="4" source="test data" type="ERROR">
- <paragraph>
- Too many autonumbered footnote references: only 2 corresponding footnotes available.
-"""],
-["""\
-Referencing a footnote by symbol [*]_.
-
-.. [*] This is an auto-symbol footnote.
-""",
-"""\
-<document source="test data">
- <paragraph>
- Referencing a footnote by symbol \n\
- <footnote_reference auto="*" id="id1" refid="id2">
- *
- .
- <footnote auto="*" backrefs="id1" id="id2">
- <label>
- *
- <paragraph>
- This is an auto-symbol footnote.
-"""],
-["""\
-A sequence of symbol footnote references:
-[*]_ [*]_ [*]_ [*]_ [*]_ [*]_ [*]_ [*]_ [*]_ [*]_ [*]_ [*]_.
-
-.. [*] Auto-symbol footnote 1.
-.. [*] Auto-symbol footnote 2.
-.. [*] Auto-symbol footnote 3.
-.. [*] Auto-symbol footnote 4.
-.. [*] Auto-symbol footnote 5.
-.. [*] Auto-symbol footnote 6.
-.. [*] Auto-symbol footnote 7.
-.. [*] Auto-symbol footnote 8.
-.. [*] Auto-symbol footnote 9.
-.. [*] Auto-symbol footnote 10.
-.. [*] Auto-symbol footnote 11.
-.. [*] Auto-symbol footnote 12.
-""",
-u"""\
-<document source="test data">
- <paragraph>
- A sequence of symbol footnote references:
- <footnote_reference auto="*" id="id1" refid="id13">
- *
- \n\
- <footnote_reference auto="*" id="id2" refid="id14">
- \u2020
- \n\
- <footnote_reference auto="*" id="id3" refid="id15">
- \u2021
- \n\
- <footnote_reference auto="*" id="id4" refid="id16">
- \u00A7
- \n\
- <footnote_reference auto="*" id="id5" refid="id17">
- \u00B6
- \n\
- <footnote_reference auto="*" id="id6" refid="id18">
- #
- \n\
- <footnote_reference auto="*" id="id7" refid="id19">
- \u2660
- \n\
- <footnote_reference auto="*" id="id8" refid="id20">
- \u2665
- \n\
- <footnote_reference auto="*" id="id9" refid="id21">
- \u2666
- \n\
- <footnote_reference auto="*" id="id10" refid="id22">
- \u2663
- \n\
- <footnote_reference auto="*" id="id11" refid="id23">
- **
- \n\
- <footnote_reference auto="*" id="id12" refid="id24">
- \u2020\u2020
- .
- <footnote auto="*" backrefs="id1" id="id13">
- <label>
- *
- <paragraph>
- Auto-symbol footnote 1.
- <footnote auto="*" backrefs="id2" id="id14">
- <label>
- \u2020
- <paragraph>
- Auto-symbol footnote 2.
- <footnote auto="*" backrefs="id3" id="id15">
- <label>
- \u2021
- <paragraph>
- Auto-symbol footnote 3.
- <footnote auto="*" backrefs="id4" id="id16">
- <label>
- \u00A7
- <paragraph>
- Auto-symbol footnote 4.
- <footnote auto="*" backrefs="id5" id="id17">
- <label>
- \u00B6
- <paragraph>
- Auto-symbol footnote 5.
- <footnote auto="*" backrefs="id6" id="id18">
- <label>
- #
- <paragraph>
- Auto-symbol footnote 6.
- <footnote auto="*" backrefs="id7" id="id19">
- <label>
- \u2660
- <paragraph>
- Auto-symbol footnote 7.
- <footnote auto="*" backrefs="id8" id="id20">
- <label>
- \u2665
- <paragraph>
- Auto-symbol footnote 8.
- <footnote auto="*" backrefs="id9" id="id21">
- <label>
- \u2666
- <paragraph>
- Auto-symbol footnote 9.
- <footnote auto="*" backrefs="id10" id="id22">
- <label>
- \u2663
- <paragraph>
- Auto-symbol footnote 10.
- <footnote auto="*" backrefs="id11" id="id23">
- <label>
- **
- <paragraph>
- Auto-symbol footnote 11.
- <footnote auto="*" backrefs="id12" id="id24">
- <label>
- \u2020\u2020
- <paragraph>
- Auto-symbol footnote 12.
-"""],
-])
-
-
-if __name__ == '__main__':
- import unittest
- unittest.main(defaultTest='suite')