Show More
@@ -146,7 +146,7 b' def new_worksheet(name=None, cells=None):' | |||
|
146 | 146 | return ws |
|
147 | 147 | |
|
148 | 148 | |
|
149 | def new_notebook(metadata=None, worksheets=None): | |
|
149 | def new_notebook(name=None, metadata=None, worksheets=None): | |
|
150 | 150 | """Create a notebook by name, id and a list of worksheets.""" |
|
151 | 151 | nb = NotebookNode() |
|
152 | 152 | nb.nbformat = nbformat |
@@ -158,6 +158,8 b' def new_notebook(metadata=None, worksheets=None):' | |||
|
158 | 158 | nb.metadata = new_metadata() |
|
159 | 159 | else: |
|
160 | 160 | nb.metadata = NotebookNode(metadata) |
|
161 | if name is not None: | |
|
162 | nb.metadata.name = unicode(name) | |
|
161 | 163 | return nb |
|
162 | 164 | |
|
163 | 165 |
@@ -112,6 +112,13 b' class TestNotebook(TestCase):' | |||
|
112 | 112 | self.assertEquals(nb.worksheets,worksheets) |
|
113 | 113 | self.assertEquals(nb.nbformat,nbformat) |
|
114 | 114 | |
|
115 | def test_notebook_name(self): | |
|
116 | worksheets = [new_worksheet(),new_worksheet()] | |
|
117 | nb = new_notebook(name='foo',worksheets=worksheets) | |
|
118 | self.assertEquals(nb.metadata.name,u'foo') | |
|
119 | self.assertEquals(nb.worksheets,worksheets) | |
|
120 | self.assertEquals(nb.nbformat,nbformat) | |
|
121 | ||
|
115 | 122 | class TestMetadata(TestCase): |
|
116 | 123 | |
|
117 | 124 | def test_empty_metadata(self): |
General Comments 0
You need to be logged in to leave comments.
Login now