modified the deletion logic as per the comments and setting the readonly cell to false

arovitn 8 years ago
parent 66b257bf3b
commit dcb45b2b34

@ -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

Loading…
Cancel
Save