def test_v1_to_latest(self): """test notebook update from version 1 to present.""" # Setup paths. old_version = 1 new_version = notebook.NOTEBOOK_FORMAT_VERSION notebook_filename = setup_old_notebook(old_version, new_version) # Load old notebook. book = notebook_v1.NoteBook() book.load(notebook_filename) old_attrs = dict(book._attr) # Update notebook (in place). update.update_notebook(notebook_filename, new_version, verify=True) # Load new notebook. book = notebook.NoteBook() book.load(notebook_filename) # Test for common error. new_attrs = dict(book.iter_attr()) self.assertEqual(new_attrs['title'], old_attrs['title']) book.close()
def test_v1_to_latest(self): """test notebook update from version 1 to present.""" # Setup paths. old_version = 1 new_version = notebook.NOTEBOOK_FORMAT_VERSION notebook_filename = setup_old_notebook(old_version, new_version) # Load old notebook. book = notebook_v1.NoteBook() book.load(notebook_filename) old_attrs = dict(book._attr) # Update notebook (in place). update.update_notebook(notebook_filename, new_version, verify=True) # Load new notebook. book = notebook.NoteBook() book.load(notebook_filename) # Test for common error. new_attrs = dict(book.iter_attr()) self.assertEqual(new_attrs["title"], old_attrs["title"]) book.close()
def test_v5_to_latest(self): # Setup paths. old_version = 5 new_version = notebook.NOTEBOOK_FORMAT_VERSION notebook_filename = setup_old_notebook(old_version, new_version) # Update notebook (in place). update.update_notebook(notebook_filename, new_version, verify=True) # Load new notebook. book = notebook.NoteBook() book.load(notebook_filename) # Test for common error. old_title = "Test Example Notebook" self.assertEqual(book.get_title(), old_title) book.close()
def test_v5_to_latest(self): # Setup paths. old_version = 5 new_version = notebook.NOTEBOOK_FORMAT_VERSION notebook_filename = setup_old_notebook(old_version, new_version) # Update notebook (in place). update.update_notebook(notebook_filename, new_version, verify=True) # Load new notebook. book = notebook.NoteBook() book.load(notebook_filename) # Test for common error. old_title = 'Test Example Notebook' self.assertEqual(book.get_title(), old_title) book.close()
def test_v3_to_v4(self): # Setup paths. old_version = 3 new_version = 4 notebook_filename = setup_old_notebook(old_version, new_version) # Load old notebook. book = notebook_v3.NoteBook() book.load(notebook_filename) old_attrs = dict(book._attr) # Update notebook (in place). update.update_notebook(notebook_filename, new_version, verify=True) # Load new notebook. book = notebook_v4.NoteBook() book.load(notebook_filename) # Test for common error. self.assertEqual(book.get_title(), old_attrs["title"])
def test_v3_to_v4(self): # Setup paths. old_version = 3 new_version = 4 notebook_filename = setup_old_notebook(old_version, new_version) # Load old notebook. book = notebook_v3.NoteBook() book.load(notebook_filename) old_attrs = dict(book._attr) # Update notebook (in place). update.update_notebook(notebook_filename, new_version, verify=True) # Load new notebook. book = notebook_v4.NoteBook() book.load(notebook_filename) # Test for common error. self.assertEqual(book.get_title(), old_attrs['title'])
def func(task): update.update_notebook(notebook_filename, notebooklib.NOTEBOOK_FORMAT_VERSION)
def func(task): update.update_notebook( notebook_filename, notebooklib.NOTEBOOK_FORMAT_VERSION)