Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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 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
Next Next commit
Update test_turtle.py (added TestRawTurtle.test_clone()
test_turtle.TestRawTurtle.test_clone(self):
    assert the last item in the items list of the cloned turtle is correct.
        more specifically, the item should be the same as the currentLineItem of the cloned turtle. 
    also, the currentLineItem of the original turtle should not be in the items list of the cloned turtle.

test_turtle.TestRawTurtle.setUp(self):
    skip test if the RawTurtle cannot be initialized because tk/tcl is not supported
  • Loading branch information
Chaebin-Kim24 authored Nov 23, 2024
commit 82550c448b42059a627bfbf40b5f8539b22d7406
14 changes: 14 additions & 0 deletions 14 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.