def test_inflate__smaller( self ): "The inflate method inflates around the center of the rectangle" r = Rect( 2, 4, 6, 8 ) r2 = r.inflate( -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 )
def test_inflate__larger( self ): "The inflate method inflates around the center of the rectangle" r = Rect( 2, 4, 6, 8 ) r2 = r.inflate( 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 )
def test_inflate__smaller(self): "The inflate method inflates around the center of the rectangle" r = Rect(2, 4, 6, 8) r2 = r.inflate(-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)
def test_inflate__larger(self): "The inflate method inflates around the center of the rectangle" r = Rect(2, 4, 6, 8) r2 = r.inflate(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)
def test_float_inflated(self): r = Rect(0, 0, 5, 5) self.assertEqual(r.inflate(1.5, 1.5), (-0.75, -0.75, 6.5, 6.5))
def test_float_inflated(self): r = Rect(0, 0, 5, 5) self.assertEqual(r.inflate(1.5, 1.5), (-0.75, -0.75, 6.5, 6.5))