Commit 77b225aa authored by Rémi Cardona's avatar Rémi Cardona
Browse files

[tests] Try to exercize pygments transforms code paths

parent efecd48dbd2a
......@@ -20,11 +20,13 @@ from logilab.common.testlib import TestCase, unittest_main
from logilab.mtconverter.engine import TransformEngine
from logilab.mtconverter import TransformData, TransformError, \
register_base_transforms, register_pil_transforms
register_base_transforms, register_pil_transforms, \
register_pygments_transforms
ENGINE = TransformEngine()
register_base_transforms(ENGINE)
register_pil_transforms(ENGINE)
_pygments_available = register_pygments_transforms(ENGINE)
import logilab.mtconverter as mtc
import os
......@@ -101,6 +103,14 @@ r2MAoIO1DSsuM23SzgmqubGJEZuSRWhR
converted = ENGINE.convert(data, 'text/plain').decode().strip()
self.assertEqual(converted, u'hello')
def test_python_to_html(self):
if not _pygments_available:
self.skipTest('pygments is not installed')
with open(__file__, 'rb') as fobj:
data = TransformData(fobj.read(), 'text/x-python3', 'latin1')
converted = ENGINE.convert(data, 'text/html').decode()
self.assertTrue(converted.startswith('<div class="highlight">'))
def tearDown(self):
for ext in ('pdf', 'aux', 'log'):
try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment