Anonymous committed 22ace91

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

Comments (0)

Files changed (2)


         if isinstance(other, basestring):
             return self.wkt == other
+        elif isinstance(other, GEOSGeometry):
+            return self.equals_exact(other)
-            return self.equals_exact(other)
+            return False
     def __ne__(self, other):
         "The not equals operator."


             self.assertEqual(GEOSGeometry(g.wkt), GEOSGeometry(geom.json))
     def test01j_eq(self):
-        "Testing equivalence with WKT."
+        "Testing equivalence."
         p = fromstr('POINT(5 23)')
         self.assertEqual(p, p.wkt)
         self.assertNotEqual(p, 'foo')
         ls = fromstr('LINESTRING(0 0, 1 1, 5 5)')
         self.assertEqual(ls, ls.wkt)
         self.assertNotEqual(p, 'bar')
+        # Error shouldn't be raise on equivalence testing with 
+        # an invalid type.
+        for g in (p, ls):
+            self.assertNotEqual(g, None)
+            self.assertNotEqual(g, {'foo' : 'bar'})
+            self.assertNotEqual(g, False)
     def test02a_points(self):
         "Testing Point objects."
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.