MCPcopy Create free account
hub / github.com/RustPython/RustPython / test_file_fault

Method test_file_fault

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

Source from the content-addressed store, hash-verified

4560 f = None
4561
4562 def test_file_fault(self):
4563 # Testing sys.stdout is changed in getattr...
4564 class StdoutGuard:
4565 def __getattr__(self, attr):
4566 sys.stdout = sys.__stdout__
4567 raise RuntimeError(f"Premature access to sys.stdout.{attr}")
4568
4569 with redirect_stdout(StdoutGuard()):
4570 with self.assertRaises(RuntimeError):
4571 print("Oops!")
4572
4573 def test_vicious_descriptor_nonsense(self):
4574 # Testing vicious_descriptor_nonsense...

Callers

nothing calls this directly

Calls 4

redirect_stdoutClass · 0.90
StdoutGuardClass · 0.85
printFunction · 0.50
assertRaisesMethod · 0.45

Tested by

no test coverage detected