From dcb45b2b34fb802bdd222af583177183e5eca2de Mon Sep 17 00:00:00 2001 From: arovitn Date: Thu, 7 Jun 2018 19:01:13 -0700 Subject: [PATCH] modified the deletion logic as per the comments and setting the readonly cell to false --- notebook/tests/selenium/test_deletecell.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/notebook/tests/selenium/test_deletecell.py b/notebook/tests/selenium/test_deletecell.py index d16537096..3b262fe94 100644 --- a/notebook/tests/selenium/test_deletecell.py +++ b/notebook/tests/selenium/test_deletecell.py @@ -3,9 +3,9 @@ def cell_is_deletable(nb, index): JS = 'return Jupyter.notebook.get_cell({}).is_deletable();'.format(index) return nb.browser.execute_script(JS) -def remove_cells(notebook): - for i in notebook.cells: - notebook.delete_cell(notebook.index(i)) +def remove_all_cells(notebook): + for i in range(len(notebook.cells)): + notebook.delete_cell(0) def test_delete_cells(notebook): a = 'print("a")' @@ -56,5 +56,6 @@ def test_delete_cells(notebook): assert len(notebook.cells) == 2 assert cell_is_deletable(notebook, 1) - remove_cells(notebook) + notebook.set_cell_metadata(0, 'deletable', 'true') # to perform below test, remove all the cells + remove_all_cells(notebook) assert len(notebook.cells) == 1 # notebook should create one automatically on empty notebook