diff --git a/IPython/nbconvert/transformers/tests/test_svg2pdf.py b/IPython/nbconvert/transformers/tests/test_svg2pdf.py new file mode 100644 index 0000000..a6f8bcf --- /dev/null +++ b/IPython/nbconvert/transformers/tests/test_svg2pdf.py @@ -0,0 +1,82 @@ +""" +Module with tests for the svg2pdf transformer +""" + +#----------------------------------------------------------------------------- +# Copyright (c) 2013, the IPython Development Team. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +from IPython.testing import decorators as dec +from IPython.nbformat import current as nbformat + +from .base import TransformerTestsBase +from ..svg2pdf import SVG2PDFTransformer + + +#----------------------------------------------------------------------------- +# Class +#----------------------------------------------------------------------------- + +class Testsvg2pdf(TransformerTestsBase): + """Contains test functions for svg2pdf.py""" + + simple_svg = """ + + + + + + +""" + + def build_notebook(self): + """Build a reveal slides notebook in memory for use with tests. + Overrides base in TransformerTestsBase""" + + outputs = [nbformat.new_output(output_type="svg", output_svg=self.simple_svg)] + + slide_metadata = {'slideshow' : {'slide_type': 'slide'}} + subslide_metadata = {'slideshow' : {'slide_type': 'subslide'}} + + cells=[nbformat.new_code_cell(input="", prompt_number=1, outputs=outputs)] + worksheets = [nbformat.new_worksheet(name="worksheet1", cells=cells)] + + return nbformat.new_notebook(name="notebook1", worksheets=worksheets) + + + def test_constructor(self): + """Can a SVG2PDFTransformer be constructed?""" + transformer = SVG2PDFTransformer() + transformer.enabled = True + return transformer + + + @dec.onlyif_cmds_exist('inkscape') + def test_output(self): + """Test the output of the SVG2PDFTransformer""" + nb, res = self.test_constructor()(self.build_notebook(), self.build_resources()) + assert 'svg' in nb.worksheets[0].cells[0].outputs[0]