summaryrefslogtreecommitdiff
path: root/creole/tests
diff options
context:
space:
mode:
authorJensDiemer <git@jensdiemer.de>2014-05-15 13:50:09 +0200
committerJensDiemer <git@jensdiemer.de>2014-05-15 13:50:09 +0200
commit1a18f5d9dd82f61f46dbc51bc4c43b8c8847d3ee (patch)
treedd5a56f793e050e02e65eec61fb39e31a7321dee /creole/tests
parent0d3ad8e3f0478f3beeddae1cee9c04ed140abc23 (diff)
downloadcreole-1a18f5d9dd82f61f46dbc51bc4c43b8c8847d3ee.tar.gz
split tests
Diffstat (limited to 'creole/tests')
-rw-r--r--creole/tests/test_creole2html.py45
1 files changed, 26 insertions, 19 deletions
diff --git a/creole/tests/test_creole2html.py b/creole/tests/test_creole2html.py
index c37684c..3f747fc 100644
--- a/creole/tests/test_creole2html.py
+++ b/creole/tests/test_creole2html.py
@@ -20,6 +20,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
import sys
import unittest
+import warnings
try:
from StringIO import StringIO
@@ -204,32 +205,38 @@ class TestCreole2html(BaseCreoleTest):
self.assertEqual(error_msg, "")
def test_code_macro(self):
- creole = (
- r"""
+ if not PYGMENTS:
+ # TODO: Use @unittest.skipIf if python 2.6 will be not support anymore
+ warnings.warn("Skip test, because 'pygments' is not installed.")
+ return
+
+ self.assert_creole2html(r"""
Here a simple code macro test:
<<code ext=".py">>
for i in xrange(10):
print('hello world')
<</code>>
- """
+ """, """
+ <p>Here a simple code macro test:</p>
+ <div class="pygments"><pre><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">xrange</span><span class="p">(</span><span class="mi">10</span><span class="p">):</span><br />
+ <span class="k">print</span><span class="p">(</span><span class="s">&#39;hello world&#39;</span><span class="p">)</span><br />
+ </pre></div><br />
+ """,
+ macros={'code': example_macros.code}
)
- if PYGMENTS:
- self.assert_creole2html(creole,
- """
- <p>Here a simple code macro test:</p>
- <div class="pygments"><pre><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">xrange</span><span class="p">(</span><span class="mi">10</span><span class="p">):</span><br />
- <span class="k">print</span><span class="p">(</span><span class="s">&#39;hello world&#39;</span><span class="p">)</span><br />
- </pre></div><br />
- """,
- macros={'code': example_macros.code}
- )
-
- # test the pre fallback, too. Will be reset in self.setUp()
- example_macros.PYGMENTS = False
-
- self.assert_creole2html(creole,
- """
+ def test_code_macro_fallback(self):
+ # force to use fallback. Will be reset in self.setUp()
+ example_macros.PYGMENTS = False
+
+ self.assert_creole2html(
+ r"""
+ Here a simple code macro test:
+ <<code ext=".py">>
+ for i in xrange(10):
+ print('hello world')
+ <</code>>
+ """, """
<p>Here a simple code macro test:</p>
<pre>for i in xrange(10):
print('hello world')</pre>