This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import io
|
||||
import types
|
||||
import sys
|
||||
import re
|
||||
import inspect as std_inspect
|
||||
|
||||
from IPython.core.oinspect import Inspector, OInfo
|
||||
@@ -38,6 +39,10 @@ def dict_to_oinfo(info_dict):
|
||||
setattr(info_obj, key, value)
|
||||
return info_obj
|
||||
|
||||
def strip_ansi(text):
|
||||
ansi_escape = re.compile(r'\x1b\[[0-9;]*m')
|
||||
return ansi_escape.sub('', text)
|
||||
|
||||
def test_rich_inspector_outputs_more_than_builtin(monkeypatch):
|
||||
# Simulate a fake IPython shell
|
||||
class FakeInspector:
|
||||
@@ -76,6 +81,8 @@ def test_rich_inspector_outputs_more_than_builtin(monkeypatch):
|
||||
inspector.pinfo(user, oname="user", info=info, detail_level=1)
|
||||
sys.stdout = original_stdout
|
||||
builtin_text = builtin_buf.getvalue()
|
||||
builtin_text = strip_ansi(builtin_text)
|
||||
|
||||
|
||||
print(rich_text, file=sys.__stdout__)
|
||||
print('\n\n\n', file=sys.__stdout__)
|
||||
|
||||
Reference in New Issue
Block a user