Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix unittest.mock imports
  • Loading branch information
JanEricNitschke committed Nov 4, 2025
commit d19be3950067e7bce9bb9acacbe80c28ac4f4771
5 changes: 3 additions & 2 deletions Lib/test/test_turtle.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pickle
import unittest
from unittest.mock import MagicMock, patch
Comment thread
JanEricNitschke marked this conversation as resolved.
Outdated
from test import support
from test.support import import_helper
from test.support import os_helper
Expand Down Expand Up @@ -57,7 +58,7 @@ def patch_screen():
instance because instantiating it requires a display.
"""
# Create a mock screen that delegates color validation to the real TurtleScreen methods
mock_screen = unittest.mock.MagicMock()
mock_screen = MagicMock()
Comment thread
JanEricNitschke marked this conversation as resolved.
Outdated
mock_screen.__class__ = turtle._Screen
mock_screen.mode.return_value = "standard"
mock_screen._colormode = 1.0
Expand All @@ -72,7 +73,7 @@ def mock_iscolorstring(color):
mock_screen._iscolorstring = mock_iscolorstring
mock_screen._colorstr = turtle._Screen._colorstr.__get__(mock_screen)

return unittest.mock.patch(
return patch(
Comment thread
JanEricNitschke marked this conversation as resolved.
Outdated
"turtle._Screen.__new__",
return_value=mock_screen
)
Expand Down
Loading