summaryrefslogtreecommitdiff
path: root/tests/test_directive_patch.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_directive_patch.py')
-rw-r--r--tests/test_directive_patch.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_directive_patch.py b/tests/test_directive_patch.py
index 7dc568b1d..b28e0f1e5 100644
--- a/tests/test_directive_patch.py
+++ b/tests/test_directive_patch.py
@@ -8,6 +8,7 @@
:license: BSD, see LICENSE for details.
"""
+import pytest
from docutils import nodes
from sphinx.testing import restructuredtext
@@ -54,6 +55,37 @@ def test_code_directive(app):
assert_node(doctree[0], language="python", linenos=True, highlight_args={'linenostart': 5})
+@pytest.mark.sphinx(testroot='directive-csv-table')
+def test_csv_table_directive(app):
+ # relative path from current document
+ text = ('.. csv-table::\n'
+ ' :file: example.csv\n')
+ doctree = restructuredtext.parse(app, text, docname="subdir/index")
+ assert_node(doctree,
+ ([nodes.table, nodes.tgroup, (nodes.colspec,
+ nodes.colspec,
+ nodes.colspec,
+ [nodes.tbody, nodes.row])],))
+ assert_node(doctree[0][0][3][0],
+ ([nodes.entry, nodes.paragraph, "FOO"],
+ [nodes.entry, nodes.paragraph, "BAR"],
+ [nodes.entry, nodes.paragraph, "BAZ"]))
+
+ # absolute path from source directory
+ text = ('.. csv-table::\n'
+ ' :file: /example.csv\n')
+ doctree = restructuredtext.parse(app, text, docname="subdir/index")
+ assert_node(doctree,
+ ([nodes.table, nodes.tgroup, (nodes.colspec,
+ nodes.colspec,
+ nodes.colspec,
+ [nodes.tbody, nodes.row])],))
+ assert_node(doctree[0][0][3][0],
+ ([nodes.entry, nodes.paragraph, "foo"],
+ [nodes.entry, nodes.paragraph, "bar"],
+ [nodes.entry, nodes.paragraph, "baz"]))
+
+
def test_math_directive(app):
# normal case
text = '.. math:: E = mc^2'