diff options
author | Georg Brandl <georg@python.org> | 2009-06-16 21:53:53 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-06-16 21:53:53 +0200 |
commit | 8092caf75c31c96ce2ee7600bd2766b192b0e259 (patch) | |
tree | 7f214081a6cc9b0406967ace33eb8a23b62869fc /tests | |
parent | 10ec412ce26020455480fed1228768ede6ef3a81 (diff) | |
download | sphinx-8092caf75c31c96ce2ee7600bd2766b192b0e259.tar.gz |
#169: Added the ``trim_doctest_flags`` config value, which is true by default.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_highlighting.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/test_highlighting.py b/tests/test_highlighting.py index ea1f25f1..7c303283 100644 --- a/tests/test_highlighting.py +++ b/tests/test_highlighting.py @@ -37,7 +37,8 @@ class MyLexer(RegexLexer): class MyFormatter(HtmlFormatter): def format(self, tokensource, outfile): - outfile.write('test') + for tok in tokensource: + outfile.write(tok[1]) class ComplainOnUnhighlighted(PygmentsBridge): @@ -69,7 +70,16 @@ def test_set_formatter(): PygmentsBridge.html_formatter = MyFormatter try: bridge = PygmentsBridge('html') - ret = bridge.highlight_block('foo', 'python') - assert ret == 'test' + ret = bridge.highlight_block('foo\n', 'python') + assert ret == 'foo\n' + finally: + PygmentsBridge.html_formatter = HtmlFormatter + +def test_trim_doctest_flags(): + PygmentsBridge.html_formatter = MyFormatter + try: + bridge = PygmentsBridge('html', trim_doctest_flags=True) + ret = bridge.highlight_block('>>> 1+2 # doctest: SKIP\n3\n', 'pycon') + assert ret == '>>> 1+2 \n3\n' finally: PygmentsBridge.html_formatter = HtmlFormatter |