Show More
@@ -953,6 +953,8 b' Currently the magic system has the following functions:\\n"""' | |||
|
953 | 953 | except UnicodeEncodeError: |
|
954 | 954 | vstr = unicode(var).encode(DEFAULT_ENCODING, |
|
955 | 955 | 'backslashreplace') |
|
956 | except: | |
|
957 | vstr = "<object with id %d (repr failed)>" % id(var) | |
|
956 | 958 | vstr = vstr.replace('\n','\\n') |
|
957 | 959 | if len(vstr) < 50: |
|
958 | 960 | print vstr |
@@ -376,6 +376,14 b' def doctest_who():' | |||
|
376 | 376 | Out[7]: ['alpha', 'beta'] |
|
377 | 377 | """ |
|
378 | 378 | |
|
379 | def test_whos(): | |
|
380 | """Check that whos is protected against objects where repr() fails.""" | |
|
381 | class A(object): | |
|
382 | def __repr__(self): | |
|
383 | raise Exception() | |
|
384 | _ip.user_ns['a'] = A() | |
|
385 | _ip.magic("whos") | |
|
386 | ||
|
379 | 387 | @py3compat.u_format |
|
380 | 388 | def doctest_precision(): |
|
381 | 389 | """doctest for %precision |
General Comments 0
You need to be logged in to leave comments.
Login now