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

Method test_save_overwrites_if_specified

Lib/test/test_turtle.py:533–544  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

531 turtle.TurtleScreen.save(screen, file_path)
532
533 def test_save_overwrites_if_specified(self) -> None:
534 screen = unittest.mock.Mock()
535 screen.cv.postscript.return_value = "postscript"
536
537 with tempfile.TemporaryDirectory() as tmpdir:
538 file_path = os.path.join(tmpdir, "some_file.ps")
539 with open(file_path, "w") as f:
540 f.write("some text")
541
542 turtle.TurtleScreen.save(screen, file_path, overwrite=True)
543 with open(file_path) as f:
544 self.assertEqual(f.read(), "postscript")
545
546 def test_save(self) -> None:
547 screen = unittest.mock.Mock()

Callers

nothing calls this directly

Calls 6

openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45
saveMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected