Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix+test %who_ls type checking, skip %who doctests

due to new docstring output being based on clean user_ns.

closes gh-228
  • Loading branch information...
commit b6416bc27c15ce9117d1df566ed75ea9b13f16c1 1 parent 96dd354
@minrk minrk authored
Showing with 29 additions and 1 deletion.
  1. +4 −1 IPython/core/magic.py
  2. +25 −0 IPython/core/tests/test_magic.py
View
5 IPython/core/magic.py
@@ -727,6 +727,7 @@ def magic_psearch(self, parameter_s=''):
except:
shell.showtraceback()
+ @testdec.skip_doctest
def magic_who_ls(self, parameter_s=''):
"""Return a sorted list of all interactive variables.
@@ -762,11 +763,12 @@ def magic_who_ls(self, parameter_s=''):
typelist = parameter_s.split()
if typelist:
typeset = set(typelist)
- out = [i for i in out if type(i).__name__ in typeset]
+ out = [i for i in out if type(user_ns[i]).__name__ in typeset]
out.sort()
return out
+ @testdec.skip_doctest
def magic_who(self, parameter_s=''):
"""Print all interactive variables, with some minimal formatting.
@@ -827,6 +829,7 @@ def magic_who(self, parameter_s=''):
print
print
+ @testdec.skip_doctest
def magic_whos(self, parameter_s=''):
"""Like %who, but gives some extra information about each variable.
View
25 IPython/core/tests/test_magic.py
@@ -362,3 +362,28 @@ def test_xmode():
for i in range(3):
_ip.magic("xmode")
nt.assert_equal(_ip.InteractiveTB.mode, xmode)
+
+def doctest_who():
+ """doctest for %who
+
+ In [1]: %reset -f
+
+ In [2]: alpha = 123
+
+ In [3]: beta = 'beta'
+
+ In [4]: %who int
+ alpha
+
+ In [5]: %who str
+ beta
+
+ In [6]: %whos
+ Variable Type Data/Info
+ ----------------------------
+ alpha int 123
+ beta str beta
+
+ In [7]: %who_ls
+ Out[7]: ['alpha', 'beta']
+ """
Please sign in to comment.
Something went wrong with that request. Please try again.