def test_help(command, expected_regex):
from pdb import StringIO
instance = PdbTest()
instance.stdout = StringIO()
# Redirect sys.stdout because Python 2 pdb.py has `print >>self.stdout` for
# some functions and plain ol' `print` for others.
try:
sys.stdout = instance.stdout
instance.do_help(command)
finally:
sys.stdout == sys.__stdout__
output = instance.stdout.getvalue()
assert re.search(expected_regex, output)
评论列表
文章目录