mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
Add test for saving notebook with .py script
This commit is contained in:
parent
8ed3a725f3
commit
b829043a60
@ -196,6 +196,25 @@ class TestNotebookManager(TestCase):
|
||||
self.assertEqual(model['name'], 'Untitled0.ipynb')
|
||||
self.assertEqual(model['path'], sub_dir.strip('/'))
|
||||
|
||||
def test_save_notebook_with_script(self):
|
||||
with TemporaryDirectory() as td:
|
||||
# Create a notebook
|
||||
nm = FileNotebookManager(notebook_dir=td)
|
||||
nm.save_script = True
|
||||
model = nm.create_notebook_model()
|
||||
name = model['name']
|
||||
path = model['path']
|
||||
|
||||
# Get the model with 'content'
|
||||
full_model = nm.get_notebook_model(name, path)
|
||||
|
||||
# Save the notebook
|
||||
model = nm.save_notebook_model(full_model, name, path)
|
||||
|
||||
# Check that the script was created
|
||||
py_path = os.path.join(td, os.path.splitext(name)[0]+'.py')
|
||||
assert os.path.exists(py_path), py_path
|
||||
|
||||
def test_delete_notebook_model(self):
|
||||
with TemporaryDirectory() as td:
|
||||
# Test in the root directory
|
||||
|
Loading…
Reference in New Issue
Block a user