Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dalthviz committed Mar 4, 2019
1 parent cd79ccc commit 31db31d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self,
:param reset: If true the persistent settings, such as column widths,
are reset.
"""
super(ObjectBrowser, self).__init__(parent=parent)
QDialog.__init__(self, parent=parent)

self._instance_nr = self._add_instance()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import logging

# Local imports
from spyder.config.base import _
from spyder.plugins.variableexplorer.widgets.objecteditor2.utils import (
cut_off_str)

Expand Down Expand Up @@ -48,19 +49,19 @@ def __init__(self, obj, name, obj_path, is_attribute, parent=None):
def __str__(self):
n_children = len(self.child_items)
if n_children == 0:
return "<TreeItem(0x{:x}): {} = {}>".format(
return _("<TreeItem(0x{:x}): {} = {}>").format(
id(self.obj),
self.obj_path,
cut_off_str(self.obj, MAX_OBJ_STR_LEN))
else:
return "<TreeItem(0x{:x}): {} ({:d} children)>".format(
return _("<TreeItem(0x{:x}): {} ({:d} children)>").format(
id(self.obj),
self.obj_path,
len(self.child_items))

def __repr__(self):
n_children = len(self.child_items)
return "<TreeItem(0x{:x}): {} ({:d} children)>" \
return _("<TreeItem(0x{:x}): {} ({:d} children)>") \
.format(id(self.obj), self.obj_path, n_children)

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@ def test_editor_parent_set(monkeypatch):
'collectionseditor.TextEditor')
monkeypatch.setattr(attr_to_patch_textedit, MockTextEditor)

MockObjectEditor = Mock()
attr_to_patch_objecteditor = ('spyder.plugins.variableexplorer.widgets.' +
'objecteditor2.objecteditor.ObjectBrowser')
monkeypatch.setattr(attr_to_patch_objecteditor, MockObjectEditor)

editor_data = [[0, 1, 2, 3, 4],
numpy.array([1.0, 42.0, 1337.0]),
pandas.DataFrame([[1, 2, 3], [20, 30, 40]]),
Expand All @@ -374,7 +379,7 @@ def test_editor_parent_set(monkeypatch):
MockArrayEditor,
MockDataFrameEditor,
MockTextEditor,
MockCollectionsEditor]):
MockObjectEditor]):
col_editor.delegate.createEditor(col_editor.parent(), None,
col_editor.model.createIndex(idx, 3))
assert mock_class.call_count == 1 + (idx // 3)
Expand Down

0 comments on commit 31db31d

Please sign in to comment.