From 0afa1e58552a3f6f8fa19855fd76ac7a4073a52e Mon Sep 17 00:00:00 2001 From: arovitn Date: Mon, 21 May 2018 18:33:42 -0700 Subject: [PATCH] Modified to use list comprehension, added '()' for to_command_mode, added assert to check presence of cell and remove 'return True' from remove_cells --- notebook/tests/selenium/test_empty_arrows_keys.py | 4 ++-- notebook/tests/selenium/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/notebook/tests/selenium/test_empty_arrows_keys.py b/notebook/tests/selenium/test_empty_arrows_keys.py index 11daa4777..c53006bc2 100755 --- a/notebook/tests/selenium/test_empty_arrows_keys.py +++ b/notebook/tests/selenium/test_empty_arrows_keys.py @@ -4,10 +4,10 @@ def remove_cells(notebook): for i in notebook.cells: notebook.delete_cell(notebook.index(i)) - return True def test_empty_arrows_keys(notebook): # delete all the cells notebook.trigger_keydown('up') notebook.trigger_keydown('down') - assert remove_cells(notebook); + remove_cells(notebook) + assert len(notebook.cells) == 1 # notebook should create one automatically on empty notebook diff --git a/notebook/tests/selenium/utils.py b/notebook/tests/selenium/utils.py index 58fb327f9..3b0e73b79 100644 --- a/notebook/tests/selenium/utils.py +++ b/notebook/tests/selenium/utils.py @@ -186,7 +186,7 @@ class Notebook: def delete_cell(self, index): self.focus_cell(index) - self.to_command_mode + self.to_command_mode() self.current_cell.send_keys('dd') def add_markdown_cell(self, index=-1, content="", render=True): @@ -276,7 +276,7 @@ def trigger_keystrokes(browser, *keys): for each_key_combination in keys: keys = each_key_combination.split('-') if len(keys) > 1: # key has modifiers eg. control, alt, shift - modifiers_keys = list(map(lambda x:getattr(Keys, x.upper()), keys[:-1])) + modifiers_keys = [getattr(Keys, x.upper()) for x in keys[:-1]] ac = ActionChains(browser) for i in modifiers_keys: ac = ac.key_down(i) ac.send_keys(keys[-1])