Show More
@@ -196,6 +196,25 b' class TestNotebookManager(TestCase):' | |||||
196 | self.assertEqual(model['name'], 'Untitled0.ipynb') |
|
196 | self.assertEqual(model['name'], 'Untitled0.ipynb') | |
197 | self.assertEqual(model['path'], sub_dir.strip('/')) |
|
197 | self.assertEqual(model['path'], sub_dir.strip('/')) | |
198 |
|
198 | |||
|
199 | def test_save_notebook_with_script(self): | |||
|
200 | with TemporaryDirectory() as td: | |||
|
201 | # Create a notebook | |||
|
202 | nm = FileNotebookManager(notebook_dir=td) | |||
|
203 | nm.save_script = True | |||
|
204 | model = nm.create_notebook_model() | |||
|
205 | name = model['name'] | |||
|
206 | path = model['path'] | |||
|
207 | ||||
|
208 | # Get the model with 'content' | |||
|
209 | full_model = nm.get_notebook_model(name, path) | |||
|
210 | ||||
|
211 | # Save the notebook | |||
|
212 | model = nm.save_notebook_model(full_model, name, path) | |||
|
213 | ||||
|
214 | # Check that the script was created | |||
|
215 | py_path = os.path.join(td, os.path.splitext(name)[0]+'.py') | |||
|
216 | assert os.path.exists(py_path), py_path | |||
|
217 | ||||
199 | def test_delete_notebook_model(self): |
|
218 | def test_delete_notebook_model(self): | |
200 | with TemporaryDirectory() as td: |
|
219 | with TemporaryDirectory() as td: | |
201 | # Test in the root directory |
|
220 | # Test in the root directory |
General Comments 0
You need to be logged in to leave comments.
Login now