##// END OF EJS Templates
Backport PR #7106: Changed the display order of rich output in nbconvert html...
Backport PR #7106: Changed the display order of rich output in nbconvert html The notebook rich output display order now matches that of nbconvert. This makes more sense than the other way around due to the need for the that are notebooks already shared on the web to remain consistent. Conversely local notebooks can simply be edited to match the new order.

File last commit:

r15442:0073d6a2
r20383:70ced73a
Show More
test_pdf.py
69 lines | 2.1 KiB | text/x-python | PythonLexer
Jonathan Frederic
Added PDF and Serve post-processor tests
r12045 """
Module with tests for the PDF post-processor
"""
#-----------------------------------------------------------------------------
# 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
#-----------------------------------------------------------------------------
MinRK
capture logging in a few tests...
r15442 import logging
Jonathan Frederic
Added PDF and Serve post-processor tests
r12045 import os
from IPython.testing import decorators as dec
from ...tests.base import TestsBase
from ..pdf import PDFPostProcessor
#-----------------------------------------------------------------------------
# Constants
#-----------------------------------------------------------------------------
HELLO_WORLD = r"""% hello.tex - Our first LaTeX example!
\documentclass{article}
\begin{document}
Hello World!
\end{document}"""
#-----------------------------------------------------------------------------
# Class
#-----------------------------------------------------------------------------
class TestPDF(TestsBase):
"""Contains test functions for pdf.py"""
Jonathan Frederic
FIXED postprocessor test typos
r12046 def test_constructor(self):
Jonathan Frederic
Added PDF and Serve post-processor tests
r12045 """Can a PDFPostProcessor be constructed?"""
PDFPostProcessor()
@dec.onlyif_cmds_exist('pdflatex')
Jonathan Frederic
FIXED postprocessor test typos
r12046 def test_pdf(self):
Jonathan Frederic
Added PDF and Serve post-processor tests
r12045 """Can a PDF be made using the PDFPostProcessor?"""
# Work in a temporary directory with hello world latex in it.
Jonathan Frederic
FIXED postprocessor test typos
r12046 with self.create_temp_cwd():
Jonathan Frederic
Added PDF and Serve post-processor tests
r12045 with open('a.tex', 'w') as f:
f.write(HELLO_WORLD)
# Construct post-processor
MinRK
capture logging in a few tests...
r15442 processor = PDFPostProcessor(log=logging.getLogger())
Jonathan Frederic
FIXED postprocessor test typos
r12046 processor.verbose = False
Jonathan Frederic
Added PDF and Serve post-processor tests
r12045 processor('a.tex')
# Check that the PDF was created.
assert os.path.isfile('a.pdf')
Brian E. Granger
Adding better logic to the PDF postprocessor.
r12269
# Make sure that temp files are cleaned up
for ext in processor.temp_file_exts:
assert not os.path.isfile('a'+ext)