'Testing closing Polygon objects.'

def test07b_closepolygons(self):

    poly = OGRGeometry('POLYGON((0    0,    5    0,    5    5,    0    5),    (1    1,    2    1,    2    2,    2    1))')
    self.assertEqual(8, poly.point_count)
    print '\nBEGIN    -    expecting    IllegalArgumentException;    safe    to    ignore.\n'
    try:
        c = poly.centroid
    except OGRException:
        pass
    else:
        self.fail('Should    have    raised    an    OGRException!')
    print '\nEND    -    expecting    IllegalArgumentException;    safe    to    ignore.\n'
    if (GDAL_VERSION <= (1, 4, 1)):
        return
    poly.close_rings()
    self.assertEqual(10, poly.point_count)
    self.assertEqual(OGRGeometry('POINT(2.5    2.5)'), poly.centroid)
