Django

Code

Changeset 8040

Show
Ignore:
Timestamp:
07/21/08 21:43:47 (5 months ago)
Author:
jbronn
Message:

gis: Fixed #7873, GEOSGeometry equivalence comparison with None should not raise an exception. Thanks, Denis.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/gis/django/contrib/gis/geos/base.py

    r7404 r8040  
    167167        if isinstance(other, basestring): 
    168168            return self.wkt == other 
    169         else
     169        elif isinstance(other, GEOSGeometry)
    170170            return self.equals_exact(other) 
     171        else: 
     172            return False 
    171173 
    172174    def __ne__(self, other): 
  • django/branches/gis/django/contrib/gis/tests/test_geos.py

    r7463 r8040  
    108108 
    109109    def test01j_eq(self): 
    110         "Testing equivalence with WKT." 
     110        "Testing equivalence." 
    111111        p = fromstr('POINT(5 23)') 
    112112        self.assertEqual(p, p.wkt) 
     
    115115        self.assertEqual(ls, ls.wkt) 
    116116        self.assertNotEqual(p, 'bar') 
     117        # Error shouldn't be raise on equivalence testing with  
     118        # an invalid type. 
     119        for g in (p, ls): 
     120            self.assertNotEqual(g, None) 
     121            self.assertNotEqual(g, {'foo' : 'bar'}) 
     122            self.assertNotEqual(g, False) 
    117123 
    118124    def test02a_points(self):