8000 gh-133244: TPen.pensize raises TurtleGraphicsError if called with a negative number by adorilson · Pull Request #135268 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-133244: TPen.pensize raises TurtleGraphicsError if called with a negative number #135268

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
gh-133244: Add TPen.pensize tests
  • Loading branch information
adorilson committed Jun 8, 2025
commit 558d97f1c82b3fdbebc4cf710a238ad2f1c2b1c2
15 changes: 15 additions & 0 deletions Lib/test/test_turtle.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,21 @@ def test_teleport(self):
tpen.teleport(-100, -100, fill_gap=fill_gap_value)
self.assertTrue(tpen.isdown())

def test_pensize_with_positive_numbers(self):
tpen = turtle.TPen()

tpen.pensize(42)
self.assertEqual(42, tpen.pensize())

def test_pensize_with_nonpositive_numbers(self):
tpen = turtle.TPen()

tpen.pensize(0)
self.assertEqual(0, tpen.pensize())

tpen.pensize(-1)
self.assertEqual(-1, tpen.pensize())


class TestTurtleScreen(unittest.TestCase):
def test_save_raises_if_wrong_extension(self) -> None:
Expand Down
0