##// END OF EJS Templates
Added space between pund and comment
Jonathan Frederic -
Show More
@@ -1,123 +1,123 b''
1 1 """
2 2 Contains tests for the nbconvertapp
3 3 """
4 4 #-----------------------------------------------------------------------------
5 5 #Copyright (c) 2013, the IPython Development Team.
6 6 #
7 7 #Distributed under the terms of the Modified BSD License.
8 8 #
9 9 #The full license is in the file COPYING.txt, distributed with this software.
10 10 #-----------------------------------------------------------------------------
11 11
12 12 #-----------------------------------------------------------------------------
13 13 # Imports
14 14 #-----------------------------------------------------------------------------
15 15
16 16 import os
17 17 from .base import TestsBase
18 18
19 19 from IPython.utils import py3compat
20 20
21 21
22 22 #-----------------------------------------------------------------------------
23 23 # Constants
24 24 #-----------------------------------------------------------------------------
25 25
26 #Define ipython commandline name
26 # Define ipython commandline name
27 27 if py3compat.PY3:
28 28 IPYTHON = 'ipython3'
29 29 else:
30 30 IPYTHON = 'ipython'
31 31
32 32
33 33 #-----------------------------------------------------------------------------
34 34 # Classes and functions
35 35 #-----------------------------------------------------------------------------
36 36
37 37 class TestNbConvertApp(TestsBase):
38 38 """Collection of NbConvertApp tests"""
39 39
40 40
41 41 def test_notebook_help(self):
42 42 """
43 43 Will help show if no notebooks are specified?
44 44 """
45 45 with self.create_temp_cwd():
46 46 assert "see '--help-all'" in self.call([IPYTHON, 'nbconvert'])
47 47
48 48
49 49 def test_glob(self):
50 50 """
51 51 Do search patterns work for notebook names?
52 52 """
53 53 with self.create_temp_cwd(['notebook*.ipynb']):
54 54 assert not 'error' in self.call([IPYTHON, 'nbconvert',
55 55 '--format="python"', '--notebooks=["*.ipynb"]']).lower()
56 56 assert os.path.isfile('notebook1.py')
57 57 assert os.path.isfile('notebook2.py')
58 58
59 59
60 60 def test_glob_subdir(self):
61 61 """
62 62 Do search patterns work for subdirectory notebook names?
63 63 """
64 64 with self.create_temp_cwd() as cwd:
65 65 self.copy_files_to(['notebook*.ipynb'], 'subdir/')
66 66 assert not 'error' in self.call([IPYTHON, 'nbconvert', '--format="python"',
67 67 '--notebooks=["%s"]' % os.path.join('subdir', '*.ipynb')]).lower()
68 68 assert os.path.isfile('notebook1.py')
69 69 assert os.path.isfile('notebook2.py')
70 70
71 71
72 72 def test_explicit(self):
73 73 """
74 74 Do explicit notebook names work?
75 75 """
76 76 with self.create_temp_cwd(['notebook*.ipynb']):
77 77 assert not 'error' in self.call([IPYTHON, 'nbconvert', '--format="python"',
78 78 '--notebooks=["notebook2.ipynb"]']).lower()
79 79 assert not os.path.isfile('notebook1.py')
80 80 assert os.path.isfile('notebook2.py')
81 81
82 82
83 83 def test_glob_explicit(self):
84 84 """
85 85 Can a search pattern be used along with matching explicit notebook names?
86 86 """
87 87 with self.create_temp_cwd(['notebook*.ipynb']):
88 88 assert not 'error' in self.call([IPYTHON, 'nbconvert', '--format="python"',
89 89 '--notebooks=["*.ipynb", "notebook1.ipynb", "notebook2.ipynb"]']).lower()
90 90 assert os.path.isfile('notebook1.py')
91 91 assert os.path.isfile('notebook2.py')
92 92
93 93
94 94 def test_explicit_glob(self):
95 95 """
96 96 Can explicit notebook names be used and then a matching search pattern?
97 97 """
98 98 with self.create_temp_cwd(['notebook*.ipynb']):
99 99 assert not 'error' in self.call([IPYTHON, 'nbconvert', '--format="python"',
100 100 '--notebooks=["notebook1.ipynb", "notebook2.ipynb", "*.ipynb"]']).lower()
101 101 assert os.path.isfile('notebook1.py')
102 102 assert os.path.isfile('notebook2.py')
103 103
104 104
105 105 def test_default_config(self):
106 106 """
107 107 Does the default config work?
108 108 """
109 109 with self.create_temp_cwd(['notebook*.ipynb', 'ipython_nbconvert_config.py']):
110 110 assert not 'error' in self.call([IPYTHON, 'nbconvert']).lower()
111 111 assert os.path.isfile('notebook1.py')
112 112 assert not os.path.isfile('notebook2.py')
113 113
114 114
115 115 def test_override_config(self):
116 116 """
117 117 Can the default config be overriden?
118 118 """
119 119 with self.create_temp_cwd(['notebook*.ipynb', 'ipython_nbconvert_config.py',
120 120 'override.py']):
121 121 assert not 'error' in self.call([IPYTHON, 'nbconvert', '--config="override.py"']).lower()
122 122 assert not os.path.isfile('notebook1.py')
123 123 assert os.path.isfile('notebook2.py')
General Comments 0
You need to be logged in to leave comments. Login now