Skip to content
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

Fix test_inflate_ip__larger. #3098

Merged
Merged
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
26 changes: 15 additions & 11 deletions test/rect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,8 @@ def test_collidepoint(self):
)

def test_inflate__larger(self):
"""The inflate method inflates around the center of the rectangle"""
"""Ensures inflating a rect keeps its center the same
and grows dimensions by correct values."""
r = Rect(2, 4, 6, 8)
r2 = r.inflate(4, 6)

Expand All @@ -785,7 +786,8 @@ def test_inflate__larger(self):
self.assertEqual(r.height + 6, r2.height)

def test_inflate__smaller(self):
"""The inflate method inflates around the center of the rectangle"""
"""Ensures deflating a rect keeps its center the same
and shrinks dimensions by correct values."""
r = Rect(2, 4, 6, 8)
r2 = r.inflate(-4, -6)

Expand All @@ -798,21 +800,23 @@ def test_inflate__smaller(self):
self.assertEqual(r.height - 6, r2.height)

def test_inflate_ip__larger(self):
"""The inflate_ip method inflates around the center of the rectangle"""
"""Ensures inflating a rect in place keeps its center the same
and grows dimensions by correct values."""
r = Rect(2, 4, 6, 8)
r2 = Rect(r)
r2.inflate_ip(-4, -6)
r2.inflate_ip(4, 6)

self.assertEqual(r.center, r2.center)
self.assertEqual(r.left + 2, r2.left)
self.assertEqual(r.top + 3, r2.top)
self.assertEqual(r.right - 2, r2.right)
self.assertEqual(r.bottom - 3, r2.bottom)
self.assertEqual(r.width - 4, r2.width)
self.assertEqual(r.height - 6, r2.height)
self.assertEqual(r.left - 2, r2.left)
self.assertEqual(r.top - 3, r2.top)
self.assertEqual(r.right + 2, r2.right)
self.assertEqual(r.bottom + 3, r2.bottom)
self.assertEqual(r.width + 4, r2.width)
self.assertEqual(r.height + 6, r2.height)

def test_inflate_ip__smaller(self):
"""The inflate method inflates around the center of the rectangle"""
"""Ensures deflating a rect in place keeps its center the same
and shrinks dimensions by correct values."""
r = Rect(2, 4, 6, 8)
r2 = Rect(r)
r2.inflate_ip(-4, -6)
Expand Down
Loading