MCPcopy Index your code
hub / github.com/ipython/ipython / __exit__

Method __exit__

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

Source from the content-addressed store, hash-verified

363
364 Counterpart of AssertPrints"""
365 def __exit__(self, etype, value, traceback):
366 __tracebackhide__ = True
367
368 try:
369 if value is not None:
370 # If an error was raised, don't check anything else
371 self.tee.close()
372 return False
373 self.tee.flush()
374 setattr(sys, self.channel, self.orig_stream)
375 printed = self.buffer.getvalue()
376 for s in self.s:
377 if isinstance(s, _re_type):
378 assert not s.search(printed),printed_msg.format(
379 s.pattern, self.channel, printed)
380 else:
381 assert s not in printed, printed_msg.format(
382 s, self.channel, printed)
383 return False
384 finally:
385 self.tee.close()
386
387@contextmanager
388def make_tempfile(name):

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