Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
logilab-mtconverter
Commits
a2a917c08159
Commit
77b225aa
authored
Sep 21, 2015
by
Rémi Cardona
Browse files
[tests] Try to exercize pygments transforms code paths
parent
efecd48dbd2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/unittest_transforms.py
View file @
a2a917c0
...
...
@@ -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
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment