MCPcopy Create free account
hub / github.com/ipython/ipython / __exit__

Method __exit__

IPython/testing/tools.py:391–409  ·  view source on GitHub ↗
(self, etype, value, traceback)

Source from the content-addressed store, hash-verified

389
390 Counterpart of AssertPrints"""
391 def __exit__(self, etype, value, traceback):
392 try:
393 if value is not None:
394 # If an error was raised, don't check anything else
395 self.tee.close()
396 return False
397 self.tee.flush()
398 setattr(sys, self.channel, self.orig_stream)
399 printed = self.buffer.getvalue()
400 for s in self.s:
401 if isinstance(s, _re_type):
402 assert not s.search(printed),printed_msg.format(
403 s.pattern, self.channel, printed)
404 else:
405 assert s not in printed, printed_msg.format(
406 s, self.channel, printed)
407 return False
408 finally:
409 self.tee.close()
410
411@contextmanager
412def mute_warn():

Callers

nothing calls this directly

Calls 4

closeMethod · 0.45
flushMethod · 0.45
searchMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected