diff --git a/spyder/app/tests/test_mainwindow.py b/spyder/app/tests/test_mainwindow.py index 69ae625bb1d..0198a9f5020 100644 --- a/spyder/app/tests/test_mainwindow.py +++ b/spyder/app/tests/test_mainwindow.py @@ -349,12 +349,12 @@ def test_single_instance_and_edit_magic(main_window, qtbot, tmpdir): spy_dir = osp.dirname(get_module_path('spyder')) lock_code = ("import sys\n" - "sys.path.append('{}')\n" + "sys.path.append(r'{spy_dir_str}')\n" "from spyder.config.base import get_conf_path\n" "from spyder.utils.external import lockfile\n" "lock_file = get_conf_path('spyder.lock')\n" "lock = lockfile.FilesystemLock(lock_file)\n" - "lock_created = lock.lock()".format(spy_dir)) + "lock_created = lock.lock()".format(spy_dir_str=spy_dir)) # Test single instance with qtbot.waitSignal(shell.executed): diff --git a/spyder/widgets/github/backend.py b/spyder/widgets/github/backend.py index 9d0b3f28fdd..2493f93259c 100644 --- a/spyder/widgets/github/backend.py +++ b/spyder/widgets/github/backend.py @@ -142,8 +142,8 @@ def send_report(self, title, body, application_log=None): repo = gh.repos(self.gh_owner)(self.gh_repo) ret = repo.issues.post(title=title, body=body) except github.ApiError as e: - _logger().warn('failed to send bug report on github. response=%r' % - e.response) + _logger().warning('Failed to send bug report on Github. ' + 'response=%r', e.response) # invalid credentials if e.response.code == 401: if self._show_msgbox: @@ -287,7 +287,7 @@ def upload_log_file(self, log_content): files={'SpyderIDE.log': {"content": log_content}}) qApp.restoreOverrideCursor() except github.ApiError: - _logger().warn('failed to upload log report as a gist') - return '"failed to upload log file as a gist"' + _logger().warning('Failed to upload log report as a gist') + return '"Failed to upload log file as a gist"' else: return ret['html_url'] diff --git a/spyder/widgets/tests/test_editor.py b/spyder/widgets/tests/test_editor.py index 0b57b67703d..a9bf593b44b 100644 --- a/spyder/widgets/tests/test_editor.py +++ b/spyder/widgets/tests/test_editor.py @@ -323,6 +323,7 @@ def test_replace_enter_press(editor_find_replace_bot): qtbot.keyPress(finder.search_text, Qt.Key_Return, modifier=Qt.ShiftModifier) assert editor.get_cursor_line_column() == (3,4) + def test_replace_plain_regex(editor_find_replace_bot): """Test that regex reserved characters are displayed as plain text.""" editor_stack, editor, finder, qtbot = editor_find_replace_bot @@ -332,10 +333,11 @@ def test_replace_plain_regex(editor_find_replace_bot): finder.show() finder.show_replace() qtbot.keyClicks(finder.search_text, 'spam') - qtbot.keyClicks(finder.replace_text, '.\[()]*test') + qtbot.keyClicks(finder.replace_text, r'.\[()]*test') qtbot.keyPress(finder.replace_text, Qt.Key_Return) assert editor.toPlainText()[0:-1] == expected_new_text + def test_replace_invalid_regex(editor_find_replace_bot): """Assert that replacing an invalid regexp does nothing.""" editor_stack, editor, finder, qtbot = editor_find_replace_bot diff --git a/spyder/widgets/variableexplorer/arrayeditor.py b/spyder/widgets/variableexplorer/arrayeditor.py index 466c2915dcf..261bd081384 100644 --- a/spyder/widgets/variableexplorer/arrayeditor.py +++ b/spyder/widgets/variableexplorer/arrayeditor.py @@ -780,11 +780,11 @@ def change_active_widget(self, index): slice_index[self.last_dim] = data_index stack_index = self.dim_indexes[self.last_dim].get(data_index) - if stack_index == None: + if stack_index is None: stack_index = self.stack.count() try: - self.stack.addWidget(ArrayEditorWidget(self, - self.data[slice_index])) + self.stack.addWidget(ArrayEditorWidget( + self, self.data[tuple(slice_index)])) except IndexError: # Handle arrays of size 0 in one axis self.stack.addWidget(ArrayEditorWidget(self, self.data)) self.dim_indexes[self.last_dim][data_index] = stack_index diff --git a/spyder/widgets/variableexplorer/collectionseditor.py b/spyder/widgets/variableexplorer/collectionseditor.py index 92dccf9d217..56ffe876ad4 100644 --- a/spyder/widgets/variableexplorer/collectionseditor.py +++ b/spyder/widgets/variableexplorer/collectionseditor.py @@ -192,17 +192,23 @@ def set_size_and_type(self, start=None, stop=None): fetch_more = False else: fetch_more = True - - if self.remote: - sizes = [ data[self.keys[index]]['size'] - for index in range(start, stop) ] - types = [ data[self.keys[index]]['type'] - for index in range(start, stop) ] - else: - sizes = [ get_size(data[self.keys[index]]) - for index in range(start, stop) ] - types = [ get_human_readable_type(data[self.keys[index]]) - for index in range(start, stop) ] + + # Ignore pandas warnings that certain attributes are deprecated + # and will be removed, since they will only be accessed if they exist. + with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", message=(r"^\w+\.\w+ is deprecated and " + "will be removed in a future version")) + if self.remote: + sizes = [data[self.keys[index]]['size'] + for index in range(start, stop)] + types = [data[self.keys[index]]['type'] + for index in range(start, stop)] + else: + sizes = [get_size(data[self.keys[index]]) + for index in range(start, stop)] + types = [get_human_readable_type(data[self.keys[index]]) + for index in range(start, stop)] if fetch_more: self.sizes = self.sizes + sizes