Skip to content

gh-126399 add test of turtle module's RawTurtle.clone() #127189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
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
14 changes: 14 additions & 0 deletions Lib/test/test_turtle.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,20 @@ def test_teleport(self):
self.assertTrue(tpen.isdown())


class TestRawTurtle(unittest.TestCase):
def setUp(self):
try:
self.screen = turtle.Screen()
except turtle.TK.TclError:
raise unittest.SkipTest() # cannot instantiate RawTurtle without a screen

def test_clone(self):
rawturtle = turtle.RawTurtle(self.screen)
another_turtle = rawturtle.clone()
self.assertEqual(another_turtle.currentLineItem, another_turtle.items[-1])
self.assertFalse(rawturtle.currentLineItem in another_turtle.items)


class TestTurtleScreen(unittest.TestCase):
def test_save_raises_if_wrong_extension(self) -> None:
screen = unittest.mock.Mock()
Expand Down
Loading