def test_existing_notebook(self): # Create a dir with notebooks td = TemporaryDirectory() ndir = td.__enter__() km = NotebookManager(notebook_dir=ndir) filename = 'new_test.ipynb' filepath = os.path.join(ndir, filename) notebook_id = km.new_notebook(ndir=ndir, name=filename) td2 = TemporaryDirectory() ndir2 = td2.__enter__() nbm = NotebookManager(notebook_dir=ndir2) assert nbm.notebook_dir != km.notebook_dir assert filepath not in nbm.path_mapping.values() assert filepath not in nbm.pathed_notebooks.values() nbm.get_pathed_notebook(filepath) assert nbm.path_mapping.values()[0] == filepath assert filepath in nbm.pathed_notebooks.values()