'Testing buffer().'

def test14_buffer(self):

    for bg in self.geometries.buffer_geoms:
        g = fromstr(bg.wkt)
        exp_buf = fromstr(bg.buffer_wkt)
        quadsegs = bg.quadsegs
        width = bg.width
        self.assertRaises(ctypes.ArgumentError, g.buffer, width, float(quadsegs))
        buf = g.buffer(width, quadsegs)
        self.assertEqual(exp_buf.num_coords, buf.num_coords)
        self.assertEqual(len(exp_buf), len(buf))
        for j in xrange(len(exp_buf)):
            exp_ring = exp_buf[j]
            buf_ring = buf[j]
            self.assertEqual(len(exp_ring), len(buf_ring))
            for k in xrange(len(exp_ring)):
                self.assertAlmostEqual(exp_ring[k][0], buf_ring[k][0], 9)
                self.assertAlmostEqual(exp_ring[k][1], buf_ring[k][1], 9)
