##// END OF EJS Templates
Merge pull request #10029 from ivanov/doctest-utils-text...
Thomas Kluyver -
r22982:67870aef merge
parent child Browse files
Show More
@@ -400,7 +400,7 b' def run_iptest():'
400 SubprocessStreamCapturePlugin() ]
400 SubprocessStreamCapturePlugin() ]
401
401
402 # we still have some vestigial doctests in core
402 # we still have some vestigial doctests in core
403 if (section.name.startswith(('core', 'IPython.core'))):
403 if (section.name.startswith(('core', 'IPython.core', 'IPython.utils'))):
404 plugins.append(IPythonDoctest())
404 plugins.append(IPythonDoctest())
405 argv.extend([
405 argv.extend([
406 '--with-ipdoctest',
406 '--with-ipdoctest',
@@ -635,7 +635,7 b' def _find_optimal(rlist, row_first=False, separator_size=2, displaywidth=80):'
635 if sumlength + separator_size * (ncols - 1) <= displaywidth:
635 if sumlength + separator_size * (ncols - 1) <= displaywidth:
636 break
636 break
637 return {'num_columns': ncols,
637 return {'num_columns': ncols,
638 'optimal_separator_width': (displaywidth - sumlength) / (ncols - 1) if (ncols - 1) else 0,
638 'optimal_separator_width': (displaywidth - sumlength) // (ncols - 1) if (ncols - 1) else 0,
639 'max_rows': max_rows,
639 'max_rows': max_rows,
640 'column_widths': col_widths
640 'column_widths': col_widths
641 }
641 }
@@ -694,17 +694,12 b' def compute_item_matrix(items, row_first=False, empty=None, *args, **kwargs) :'
694 ::
694 ::
695
695
696 In [1]: l = ['aaa','b','cc','d','eeeee','f','g','h','i','j','k','l']
696 In [1]: l = ['aaa','b','cc','d','eeeee','f','g','h','i','j','k','l']
697 ...: compute_item_matrix(l, displaywidth=12)
697 In [2]: list, info = compute_item_matrix(l, displaywidth=12)
698 Out[1]:
698 In [3]: list
699 ([['aaa', 'f', 'k'],
699 Out[3]: [['aaa', 'f', 'k'], ['b', 'g', 'l'], ['cc', 'h', None], ['d', 'i', None], ['eeeee', 'j', None]]
700 ['b', 'g', 'l'],
700 In [4]: ideal = {'num_columns': 3, 'column_widths': [5, 1, 1], 'optimal_separator_width': 2, 'max_rows': 5}
701 ['cc', 'h', None],
701 In [5]: all((info[k] == ideal[k] for k in ideal.keys()))
702 ['d', 'i', None],
702 Out[5]: True
703 ['eeeee', 'j', None]],
704 {'num_columns': 3,
705 'column_widths': [5, 1, 1],
706 'optimal_separator_width': 2,
707 'max_rows': 5})
708 """
703 """
709 info = _find_optimal(list(map(len, items)), row_first, *args, **kwargs)
704 info = _find_optimal(list(map(len, items)), row_first, *args, **kwargs)
710 nrow, ncol = info['max_rows'], info['num_columns']
705 nrow, ncol = info['max_rows'], info['num_columns']
General Comments 0
You need to be logged in to leave comments. Login now