From 4013529c4deeb5a601726905c6da4d2d5cf9e2b0 2020-02-11 19:56:38 From: Alex Hall Date: 2020-02-11 19:56:38 Subject: [PATCH] Update doctests. Use repr when showing variables --- diff --git a/IPython/core/tests/test_iplib.py b/IPython/core/tests/test_iplib.py index adadae5..8f380f9 100644 --- a/IPython/core/tests/test_iplib.py +++ b/IPython/core/tests/test_iplib.py @@ -65,8 +65,8 @@ In [4]: run simpleerr.py ZeroDivisionError Traceback (most recent call last) ... in + 29 except IndexError: 30 mode = 'div' - 31 ---> 32 bar(mode) ... in bar(mode) @@ -80,8 +80,6 @@ ZeroDivisionError Traceback (most recent call last) 6 x = 1 7 y = 0 ----> 8 x/y - 9 - 10 def sysexit(stat, mode): ZeroDivisionError: ... """ @@ -97,17 +95,15 @@ In [6]: run simpleerr.py ZeroDivisionError Traceback (most recent call last) ... in + 29 except IndexError: 30 mode = 'div' - 31 ---> 32 bar(mode) - global bar = - global mode = 'div' + mode = 'div' ... in bar(mode='div') 14 "bar" 15 if mode=='div': ---> 16 div0() - global div0 = 17 elif mode=='exit': 18 try: @@ -117,8 +113,6 @@ ZeroDivisionError Traceback (most recent call last) ----> 8 x/y x = 1 y = 0 - 9 - 10 def sysexit(stat, mode): ZeroDivisionError: ... """ @@ -154,8 +148,8 @@ In [22]: %tb SystemExit Traceback (most recent call last) ... + 29 except IndexError: 30 mode = 'div' - 31 ---> 32 bar(mode) ...bar(mode) @@ -166,11 +160,8 @@ SystemExit Traceback (most recent call last) 24 raise ValueError('Unknown mode') ...sysexit(stat, mode) - 9 10 def sysexit(stat, mode): ---> 11 raise SystemExit(stat, 'Mode = %s' % mode) - 12 - 13 def bar(mode): SystemExit: (2, 'Mode = exit') diff --git a/IPython/core/ultratb.py b/IPython/core/ultratb.py index f7d9fca..e8d4fbb 100644 --- a/IPython/core/ultratb.py +++ b/IPython/core/ultratb.py @@ -646,7 +646,7 @@ class VerboseTB(TBTools): lvals_list = [] if self.include_vars: for var in frame_info.variables_in_executing_piece: - lvals_list.append(tpl_name_val % (var.name, var.value)) + lvals_list.append(tpl_name_val % (var.name, repr(var.value))) if lvals_list: lvals = '%s%s' % (indent, em_normal.join(lvals_list))