diff options
author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-01-09 20:44:25 +0000 |
---|---|---|
committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-01-09 20:44:25 +0000 |
commit | d77fdfef70e08114f57cbef5d91707df8717ea9f (patch) | |
tree | 49444e3486c0c333cb7b33dfa721296c08ee4ece /test/test_parsers/test_rst/test_SimpleTableParser.py | |
parent | 53cd16ca6ca5f638cbe5956988e88f9339e355cf (diff) | |
parent | 3993c4097756e9885bcfbd07cb1cc1e4e95e50e4 (diff) | |
download | docutils-0.4.tar.gz |
Release 0.4: tagging released revisiondocutils-0.4
git-svn-id: http://svn.code.sf.net/p/docutils/code/tags/docutils-0.4@4268 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test/test_parsers/test_rst/test_SimpleTableParser.py')
-rwxr-xr-x | test/test_parsers/test_rst/test_SimpleTableParser.py | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/test/test_parsers/test_rst/test_SimpleTableParser.py b/test/test_parsers/test_rst/test_SimpleTableParser.py new file mode 100755 index 000000000..aee037206 --- /dev/null +++ b/test/test_parsers/test_rst/test_SimpleTableParser.py @@ -0,0 +1,123 @@ +#! /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 states.py. +""" + +from __init__ import DocutilsTestSupport + +def suite(): + s = DocutilsTestSupport.SimpleTableParserTestSuite() + s.generateTests(totest) + return s + +totest = {} + +totest['simple_tables'] = [ +["""\ +============ ============ +A table with two columns. +============ ============ +""", +([12, 12], + [], + [[[0, 0, 1, ['A table with']], + [0, 0, 1, ['two columns.']]]])], +["""\ +============ ============ +A table with two columns +and two rows. +============ ============ +""", +([12, 12], + [], + [[[0, 0, 1, ['A table with']], + [0, 0, 1, ['two columns']]], + [[0, 0, 2, ['and']], + [0, 0, 2, ['two rows.']]]])], +["""\ +========== =========== +A table with four rows, +----------------------- +and two columns. +First and last rows +contain column spans. +======================= +""", +([10, 11], + [], + [[[0, 1, 1, ['A table with four rows,']]], + [[0, 0, 3, ['and two']], + [0, 0, 3, ['columns.']]], + [[0, 0, 4, ['First and']], + [0, 0, 4, ['last rows']]], + [[0, 1, 5, ['contain column spans.']]]])], +["""\ +======= ===== ====== +A bad table cell 2 +cell 3 cell 4 +============ ====== +""", +'TableMarkupError: Text in column margin at line offset 1.'], +["""\ +=========== ================ +A table with two header rows, +----------------------------- +the first with a span. +=========== ================ +Two body rows, +the second with a span. +============================= +""", +([11, 16], + [[[0, 1, 1, ['A table with two header rows,']]], + [[0, 0, 3, ['the first']], + [0, 0, 3, ['with a span.']]]], + [[[0, 0, 5, ['Two body']], + [0, 0, 5, ['rows,']]], + [[0, 1, 6, ['the second with a span.']]]])], +["""\ +============ ============= +A table with two head/body +============ ============= +row separators. +============ ============= +That's bad. +============ ============= +""", +'TableMarkupError: Multiple head/body row separators in table ' +'(at line offset 2 and 4); only one allowed.'], +["""\ +============ ============ +============ ============ +""", +([12, 12], + [], + [[[0, 0, 1, []], + [0, 0, 1, []]]])], +# ["""\ +# ============== ========== +# Table with row separators +# ============== ========== +# and blank +# -------------- ---------- +# entries +# -------------- ---------- +# in first +# -------------- ---------- +# columns. +# ============== ========== +# """, +# ''] +] + + +if __name__ == '__main__': + import unittest + unittest.main(defaultTest='suite') |