Show More
@@ -1,63 +1,64 b'' | |||
|
1 | 1 | """ |
|
2 | 2 | Module with tests for the PDF post-processor |
|
3 | 3 | """ |
|
4 | 4 | |
|
5 | 5 | #----------------------------------------------------------------------------- |
|
6 | 6 | # Copyright (c) 2013, the IPython Development Team. |
|
7 | 7 | # |
|
8 | 8 | # Distributed under the terms of the Modified BSD License. |
|
9 | 9 | # |
|
10 | 10 | # The full license is in the file COPYING.txt, distributed with this software. |
|
11 | 11 | #----------------------------------------------------------------------------- |
|
12 | 12 | |
|
13 | 13 | #----------------------------------------------------------------------------- |
|
14 | 14 | # Imports |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | |
|
17 | 17 | import os |
|
18 | 18 | |
|
19 | 19 | from IPython.testing import decorators as dec |
|
20 | 20 | |
|
21 | 21 | from ...tests.base import TestsBase |
|
22 | 22 | from ..pdf import PDFPostProcessor |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | #----------------------------------------------------------------------------- |
|
26 | 26 | # Constants |
|
27 | 27 | #----------------------------------------------------------------------------- |
|
28 | 28 | |
|
29 | 29 | HELLO_WORLD = r"""% hello.tex - Our first LaTeX example! |
|
30 | 30 | \documentclass{article} |
|
31 | 31 | \begin{document} |
|
32 | 32 | Hello World! |
|
33 | 33 | \end{document}""" |
|
34 | 34 | |
|
35 | 35 | |
|
36 | 36 | #----------------------------------------------------------------------------- |
|
37 | 37 | # Class |
|
38 | 38 | #----------------------------------------------------------------------------- |
|
39 | 39 | |
|
40 | 40 | class TestPDF(TestsBase): |
|
41 | 41 | """Contains test functions for pdf.py""" |
|
42 | 42 | |
|
43 | 43 | |
|
44 | def test_constructor(): | |
|
44 | def test_constructor(self): | |
|
45 | 45 | """Can a PDFPostProcessor be constructed?""" |
|
46 | 46 | PDFPostProcessor() |
|
47 | 47 | |
|
48 | 48 | |
|
49 | 49 | @dec.onlyif_cmds_exist('pdflatex') |
|
50 | def test_pdf(): | |
|
50 | def test_pdf(self): | |
|
51 | 51 | """Can a PDF be made using the PDFPostProcessor?""" |
|
52 | 52 | |
|
53 | 53 | # Work in a temporary directory with hello world latex in it. |
|
54 | with self.create_temp_cwd() | |
|
54 | with self.create_temp_cwd(): | |
|
55 | 55 | with open('a.tex', 'w') as f: |
|
56 | 56 | f.write(HELLO_WORLD) |
|
57 | 57 | |
|
58 | 58 | # Construct post-processor |
|
59 | 59 | processor = PDFPostProcessor() |
|
60 | processor.verbose = False | |
|
60 | 61 | processor('a.tex') |
|
61 | 62 | |
|
62 | 63 | # Check that the PDF was created. |
|
63 | 64 | assert os.path.isfile('a.pdf') |
@@ -1,31 +1,31 b'' | |||
|
1 | 1 | """ |
|
2 | 2 | Module with tests for the serve post-processor |
|
3 | 3 | """ |
|
4 | 4 | |
|
5 | 5 | #----------------------------------------------------------------------------- |
|
6 | 6 | # Copyright (c) 2013, the IPython Development Team. |
|
7 | 7 | # |
|
8 | 8 | # Distributed under the terms of the Modified BSD License. |
|
9 | 9 | # |
|
10 | 10 | # The full license is in the file COPYING.txt, distributed with this software. |
|
11 | 11 | #----------------------------------------------------------------------------- |
|
12 | 12 | |
|
13 | 13 | #----------------------------------------------------------------------------- |
|
14 | 14 | # Imports |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | |
|
17 | 17 | from ...tests.base import TestsBase |
|
18 | 18 | from ..serve import ServePostProcessor |
|
19 | 19 | |
|
20 | 20 | |
|
21 | 21 | #----------------------------------------------------------------------------- |
|
22 | 22 | # Class |
|
23 | 23 | #----------------------------------------------------------------------------- |
|
24 | 24 | |
|
25 | 25 | class TestServe(TestsBase): |
|
26 | 26 | """Contains test functions for serve.py""" |
|
27 | 27 | |
|
28 | 28 | |
|
29 | def test_constructor(): | |
|
29 | def test_constructor(self): | |
|
30 | 30 | """Can a ServePostProcessor be constructed?""" |
|
31 | 31 | ServePostProcessor() |
General Comments 0
You need to be logged in to leave comments.
Login now