summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-06-04 18:21:26 +0200
committerGeorg Brandl <georg@python.org>2009-06-04 18:21:26 +0200
commitc335e3655f03dde6482a7634823761aa9d800c81 (patch)
tree6e62edcf459dbe05693eb60e89b68b7b63b48862 /tests
parentbe8d4364ec7208f979b1b42776a8ce14c520dee4 (diff)
downloadsphinx-c335e3655f03dde6482a7634823761aa9d800c81.tar.gz
When highlighting Python code, ignore extra indentation before
trying to parse it as Python.
Diffstat (limited to 'tests')
-rw-r--r--tests/root/includes.txt17
-rw-r--r--tests/test_build.py4
2 files changed, 15 insertions, 6 deletions
diff --git a/tests/root/includes.txt b/tests/root/includes.txt
index 44e33af0..0976bf4a 100644
--- a/tests/root/includes.txt
+++ b/tests/root/includes.txt
@@ -1,3 +1,10 @@
+Testing downloadable files
+==========================
+
+Download :download:`img.png` here.
+Download :download:`this <subdir/img.png>` there.
+Don't download :download:`this <nonexisting.png>`.
+
Test file and literal inclusion
===============================
@@ -37,10 +44,10 @@ Literalinclude options
:start-after: coding: utf-8
:end-before: class Foo
+Test if dedenting before parsing works.
-Testing downloadable files
-==========================
+.. highlight:: python
-Download :download:`img.png` here.
-Download :download:`this <subdir/img.png>` there.
-Don't download :download:`this <nonexisting.png>`.
+.. cssclass:: inc-pyobj-dedent
+.. literalinclude:: literal.inc
+ :pyobject: Bar.baz
diff --git a/tests/test_build.py b/tests/test_build.py
index 72c821d0..4c25c146 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -43,7 +43,7 @@ ENV_WARNINGS = """\
http://www.python.org/logo.png
%(root)s/includes.txt:: (WARNING/2) Encoding 'utf-8-sig' used for reading \
included file u'wrongenc.inc' seems to be wrong, try giving an :encoding: option
-%(root)s/includes.txt:56: WARNING: download file not readable: nonexisting.png
+%(root)s/includes.txt:4: WARNING: download file not readable: nonexisting.png
"""
HTML_WARNINGS = ENV_WARNINGS + """\
@@ -134,6 +134,8 @@ if pygments:
r'^class Foo:\n pass\nclass Bar:\n$',
".//div[@class='inc-startend highlight-text']/div/pre":
ur'^foo = u"Including Unicode characters: üöä"\n$',
+ ".//div[@class='inc-pyobj-dedent highlight-python']/div/pre/span":
+ r'def',
})
HTML_XPATH['subdir/includes.html'].update({
".//pre/span": 'line 1',