Show More
@@ -85,7 +85,7 b' import re' | |||
|
85 | 85 | import datetime |
|
86 | 86 | from collections import deque |
|
87 | 87 | |
|
88 | from IPython.utils.py3compat import PY3, cast_unicode, string_types | |
|
88 | from IPython.utils.py3compat import PY3, PYPY, cast_unicode, string_types | |
|
89 | 89 | from IPython.utils.encoding import get_stream_enc |
|
90 | 90 | |
|
91 | 91 | from io import StringIO |
@@ -632,7 +632,11 b' def _super_pprint(obj, p, cycle):' | |||
|
632 | 632 | p.pretty(obj.__thisclass__) |
|
633 | 633 | p.text(',') |
|
634 | 634 | p.breakable() |
|
635 | p.pretty(obj.__self__) | |
|
635 | if PYPY: # In PyPy, super() objects doesn't have __self__ attributes | |
|
636 | dself = obj.__repr__.__self__ | |
|
637 | p.pretty(None if dself is obj else dself) | |
|
638 | else: | |
|
639 | p.pretty(obj.__self__) | |
|
636 | 640 | p.end_group(8, '>') |
|
637 | 641 | |
|
638 | 642 |
@@ -188,12 +188,14 b' class SB(SA):' | |||
|
188 | 188 | pass |
|
189 | 189 | |
|
190 | 190 | def test_super_repr(): |
|
191 | # "<super: module_name.SA, None>" | |
|
191 | 192 | output = pretty.pretty(super(SA)) |
|
192 | nt.assert_in("SA", output) | |
|
193 | nt.assert_regexp_matches(output, r"<super: \S+.SA, None>") | |
|
193 | 194 | |
|
195 | # "<super: module_name.SA, <module_name.SB at 0x...>>" | |
|
194 | 196 | sb = SB() |
|
195 | 197 | output = pretty.pretty(super(SA, sb)) |
|
196 | nt.assert_in("SA", output) | |
|
198 | nt.assert_regexp_matches(output, r"<super: \S+.SA,\s+<\S+.SB at 0x\S+>>") | |
|
197 | 199 | |
|
198 | 200 | |
|
199 | 201 | def test_long_list(): |
General Comments 0
You need to be logged in to leave comments.
Login now