Add assertions for insert below and above cell commands in command mode and also after editing cells in edit mode

This commit is contained in:
sheshtawy 2018-04-26 14:40:19 -04:00
parent c4adc5266f
commit a46f5b81a1

View File

@ -1,9 +1,9 @@
def test_insert_cell(notebook):
a = 'print("a")'
b = 'print("b")'
c = 'print("c")'
a = "print('a')"
b = "print('b')"
c = "print('c')"
notebook.edit_cell(index=0, content=a)
notebook.append(b, c)
@ -14,15 +14,18 @@ def test_insert_cell(notebook):
notebook.to_command_mode()
notebook.focus_cell(2)
notebook.convert_cell_type(2, "markdown")
# insert code cell above
notebook.current_cell.send_keys("a")
assert notebook.get_cell_contents(2) == ''
assert notebook.get_cell_type(2) == 'code'
assert notebook.get_cell_contents(2) == ""
assert notebook.get_cell_type(2) == "code"
assert len(notebook.cells) == 4
notebook.current_cell.send_keys('b')
assert notebook.get_cell_contents(2) == ''
assert notebook.get_cell_contents(3) == ''
assert notebook.get_cell_type(3) == 'code'
# insert code cell below
notebook.current_cell.send_keys("b")
assert notebook.get_cell_contents(2) == ""
assert notebook.get_cell_contents(3) == ""
assert notebook.get_cell_type(3) == "code"
assert len(notebook.cells) == 5
notebook.focus_cell(2)
@ -32,3 +35,19 @@ def test_insert_cell(notebook):
assert notebook.get_cell_type(3) == "markdown"
notebook.current_cell.send_keys("b")
assert notebook.get_cell_type(4) == "markdown"
notebook.edit_cell(index=1, content="cell1")
notebook.focus_cell(1)
notebook.current_cell.send_keys("a")
assert notebook.get_cell_contents(1) == ""
assert notebook.get_cell_contents(2) == "cell1"
notebook.edit_cell(index=1, content='cell1')
notebook.edit_cell(index=2, content='cell2')
notebook.edit_cell(index=3, content='cell3')
notebook.focus_cell(2)
notebook.current_cell.send_keys("b")
assert notebook.get_cell_contents(1) == "cell1"
assert notebook.get_cell_contents(2) == "cell2"
assert notebook.get_cell_contents(3) == ""
assert notebook.get_cell_contents(4) == "cell3"