Skip to content

Commit

Permalink
Merge pull request #4955 from ccordoba12/change-format-to-6g
Browse files Browse the repository at this point in the history
PR: Change format in array and dataframe editors
  • Loading branch information
ccordoba12 authored Aug 14, 2017
2 parents 5b3985f + 7c32809 commit f5b82ba
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
2 changes: 2 additions & 0 deletions spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,8 @@ def test_varexp_magic_dbg(main_window, qtbot):


@flaky(max_runs=3)
@pytest.mark.skipif(os.environ.get('CI', None) is None,
reason="It's not meant to be run outside of a CI")
def test_fileswitcher(main_window, qtbot):
"""Test the use of shorten paths when necessary in the fileswitcher."""
# Load tests files
Expand Down
6 changes: 3 additions & 3 deletions spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@
('variable_explorer',
{
'check_all': CHECK_ALL,
'dataframe_format': '.3g', # no percent sign to avoid problems
# with ConfigParser's interpolation
'dataframe_format': '.6g', # No percent sign to avoid problems
# with ConfigParser's interpolation
'excluded_names': EXCLUDED_NAMES,
'exclude_private': True,
'exclude_uppercase': True,
Expand Down Expand Up @@ -633,7 +633,7 @@
# or if you want to *rename* options, then you need to do a MAJOR update in
# version, e.g. from 3.0.0 to 4.0.0
# 3. You don't need to touch this value if you're just adding a new option
CONF_VERSION = '40.0.0'
CONF_VERSION = '40.1.0'

# Main configuration instance
try:
Expand Down
20 changes: 10 additions & 10 deletions spyder/widgets/variableexplorer/arrayeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@

# Note: string and unicode data types will be formatted with '%s' (see below)
SUPPORTED_FORMATS = {
'single': '%.3f',
'double': '%.3f',
'float_': '%.3f',
'longfloat': '%.3f',
'float16': '%.3f',
'float32': '%.3f',
'float64': '%.3f',
'float96': '%.3f',
'float128': '%.3f',
'single': '%.6g',
'double': '%.6g',
'float_': '%.6g',
'longfloat': '%.6g',
'float16': '%.6g',
'float32': '%.6g',
'float64': '%.6g',
'float96': '%.6g',
'float128': '%.6g',
'csingle': '%r',
'complex_': '%r',
'clongfloat': '%r',
Expand Down Expand Up @@ -119,7 +119,7 @@ class ArrayModel(QAbstractTableModel):
ROWS_TO_LOAD = 500
COLS_TO_LOAD = 40

def __init__(self, data, format="%.3f", xlabels=None, ylabels=None,
def __init__(self, data, format="%.6g", xlabels=None, ylabels=None,
readonly=False, parent=None):
QAbstractTableModel.__init__(self)

Expand Down
2 changes: 1 addition & 1 deletion spyder/widgets/variableexplorer/dataframeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
_bool_false = ['false', '0']

# Default format for data frames with floats
DEFAULT_FORMAT = '%.3g'
DEFAULT_FORMAT = '%.6g'

# Limit at which dataframe is considered so large that it is loaded on demand
LARGE_SIZE = 5e5
Expand Down
2 changes: 1 addition & 1 deletion spyder/widgets/variableexplorer/tests/test_arrayeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_arrayeditor_format(qtbot):
qtbot.keyClick(dlg.arraywidget.view, Qt.Key_Down, modifier=Qt.ShiftModifier)
qtbot.keyClick(dlg.arraywidget.view, Qt.Key_Down, modifier=Qt.ShiftModifier)
contents = dlg.arraywidget.view._sel_to_text(dlg.arraywidget.view.selectedIndexes())
assert contents == "1.000\n2.000\n"
assert contents == "1\n2\n"
dlg.arraywidget.view.model().set_format("%.18e")
assert dlg.arraywidget.view.model().get_format() == "%.18e"
qtbot.keyClick(dlg.arraywidget.view, Qt.Key_Down, modifier=Qt.ShiftModifier)
Expand Down

0 comments on commit f5b82ba

Please sign in to comment.