MCPcopy Index your code
hub / github.com/python/cpython / test_file_fault

Method test_file_fault

Lib/test/test_descr.py:4781–4790  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4779 f = None
4780
4781 def test_file_fault(self):
4782 # Testing sys.stdout is changed in getattr...
4783 class StdoutGuard:
4784 def __getattr__(self, attr):
4785 sys.stdout = sys.__stdout__
4786 raise RuntimeError(f"Premature access to sys.stdout.{attr}")
4787
4788 with redirect_stdout(StdoutGuard()):
4789 with self.assertRaises(RuntimeError):
4790 print("Oops!")
4791
4792 def test_vicious_descriptor_nonsense(self):
4793 # Testing vicious_descriptor_nonsense...

Callers

nothing calls this directly

Calls 3

redirect_stdoutClass · 0.90
StdoutGuardClass · 0.85
assertRaisesMethod · 0.45

Tested by

no test coverage detected