Show More
@@ -1,34 +1,34 b'' | |||
|
1 | 1 | """Tests for the notebook manager.""" |
|
2 | 2 | |
|
3 | 3 | import os |
|
4 | 4 | from unittest import TestCase |
|
5 | 5 | from tempfile import NamedTemporaryFile |
|
6 | 6 | |
|
7 | 7 | from IPython.utils.tempdir import TemporaryDirectory |
|
8 | 8 | from IPython.utils.traitlets import TraitError |
|
9 | 9 | |
|
10 |
from |
|
|
10 | from ..filenbmanager import FileNotebookManager | |
|
11 | 11 | |
|
12 | 12 | class TestNotebookManager(TestCase): |
|
13 | 13 | |
|
14 | 14 | def test_nb_dir(self): |
|
15 | 15 | with TemporaryDirectory() as td: |
|
16 | 16 | km = FileNotebookManager(notebook_dir=td) |
|
17 | 17 | self.assertEqual(km.notebook_dir, td) |
|
18 | 18 | |
|
19 | 19 | def test_create_nb_dir(self): |
|
20 | 20 | with TemporaryDirectory() as td: |
|
21 | 21 | nbdir = os.path.join(td, 'notebooks') |
|
22 | 22 | km = FileNotebookManager(notebook_dir=nbdir) |
|
23 | 23 | self.assertEqual(km.notebook_dir, nbdir) |
|
24 | 24 | |
|
25 | 25 | def test_missing_nb_dir(self): |
|
26 | 26 | with TemporaryDirectory() as td: |
|
27 | 27 | nbdir = os.path.join(td, 'notebook', 'dir', 'is', 'missing') |
|
28 | 28 | self.assertRaises(TraitError, FileNotebookManager, notebook_dir=nbdir) |
|
29 | 29 | |
|
30 | 30 | def test_invalid_nb_dir(self): |
|
31 | 31 | with NamedTemporaryFile() as tf: |
|
32 | 32 | self.assertRaises(TraitError, FileNotebookManager, notebook_dir=tf.name) |
|
33 | 33 | |
|
34 | 34 |
General Comments 0
You need to be logged in to leave comments.
Login now