diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index fc462b3..8d088cc 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -400,7 +400,7 @@ def run_iptest(): SubprocessStreamCapturePlugin() ] # we still have some vestigial doctests in core - if (section.name.startswith(('core', 'IPython.core'))): + if (section.name.startswith(('core', 'IPython.core', 'IPython.utils'))): plugins.append(IPythonDoctest()) argv.extend([ '--with-ipdoctest', diff --git a/IPython/utils/text.py b/IPython/utils/text.py index f61808f..0ad1c8d 100644 --- a/IPython/utils/text.py +++ b/IPython/utils/text.py @@ -635,7 +635,7 @@ def _find_optimal(rlist, row_first=False, separator_size=2, displaywidth=80): if sumlength + separator_size * (ncols - 1) <= displaywidth: break return {'num_columns': ncols, - 'optimal_separator_width': (displaywidth - sumlength) / (ncols - 1) if (ncols - 1) else 0, + 'optimal_separator_width': (displaywidth - sumlength) // (ncols - 1) if (ncols - 1) else 0, 'max_rows': max_rows, 'column_widths': col_widths } @@ -694,17 +694,12 @@ def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) : :: In [1]: l = ['aaa','b','cc','d','eeeee','f','g','h','i','j','k','l'] - ...: compute_item_matrix(l, displaywidth=12) - Out[1]: - ([['aaa', 'f', 'k'], - ['b', 'g', 'l'], - ['cc', 'h', None], - ['d', 'i', None], - ['eeeee', 'j', None]], - {'num_columns': 3, - 'column_widths': [5, 1, 1], - 'optimal_separator_width': 2, - 'max_rows': 5}) + In [2]: list, info = compute_item_matrix(l, displaywidth=12) + In [3]: list + Out[3]: [['aaa', 'f', 'k'], ['b', 'g', 'l'], ['cc', 'h', None], ['d', 'i', None], ['eeeee', 'j', None]] + In [4]: ideal = {'num_columns': 3, 'column_widths': [5, 1, 1], 'optimal_separator_width': 2, 'max_rows': 5} + In [5]: all((info[k] == ideal[k] for k in ideal.keys())) + Out[5]: True """ info = _find_optimal(list(map(len, items)), row_first, *args, **kwargs) nrow, ncol = info['max_rows'], info['num_columns']