Ticket #10380: gis_envelope_min_max.diff

File gis_envelope_min_max.diff, 1.6 KB (added by psmith, 16 years ago)

Patch to envelope.py with unit test

  • django/contrib/gis/tests/test_gdal_envelope.py

     
    1515        self.assertRaises(OGRException, Envelope, ())
    1616        self.assertRaises(ValueError, Envelope, 0, 'a', 5, 5)
    1717        self.assertRaises(TypeError, Envelope, u'foo')
     18        self.assertRaises(OGRException, Envelope, (1, 1, 0, 0))
     19        try:
     20            Envelope(0, 0, 0, 0)
     21        except OGRException:
     22            self.fail('shouldn\'t raise an exception for min_x == max_x or min_y == max_y')
    1823
    1924    def test02_properties(self):
    2025        "Testing Envelope properties."
  • django/contrib/gis/gdal/envelope.py

     
    5858            raise OGRException('Incorrect number (%d) of arguments.' % len(args))
    5959
    6060        # Checking the x,y coordinates
    61         if self.min_x >= self.max_x:
    62             raise OGRException('Envelope minimum X >= maximum X.')
    63         if self.min_y >= self.max_y:
    64             raise OGRException('Envelope minimum Y >= maximum Y.')
     61        if self.min_x > self.max_x:
     62            raise OGRException('Envelope minimum X > maximum X.')
     63        if self.min_y > self.max_y:
     64            raise OGRException('Envelope minimum Y > maximum Y.')
    6565
    6666    def __eq__(self, other):
    6767        """
Back to Top