def test_insert_multiple(self): ix = GeoIndex('./test_indices', 'test_insert_multiple', int, int) ix.bulk_insert([(1, poly1), (2, poly2), (3, poly3)]) x = ix.equals(poly1) x = list(x) self.assertEqual(len(x), 1) self.assertEqual(x[0], 1, "Geom in index for poly 1 isn't exact") x = ix.equals(poly2) x = list(x) self.assertEqual(len(x), 1) self.assertEqual(x[0], 2, "Geom in index for poly 2 isn't exact") x = ix.equals(poly3) x = list(x) self.assertEqual(len(x), 1) self.assertEqual(x[0], 3, "Geom in index for poly 3 isn't exact") x = ix.within(cover) x = list(x) self.assertEqual(len(x), 3) self.assertEqual(sorted(x), [1,2,3], "Didn't pull back all ids") ix.drop()
def test_insert_one(self): ix = GeoIndex('./test_indices', 'test_insert_one', int, int) ix.insert(1L, poly1) x = ix.within(cover) x = list(x) self.assertEqual(len(x), 1) self.assertEqual(x[0], 1L, "Geom in index doesn't overlap") x = ix.equals(poly1) x = list(x) self.assertEqual(len(x), 1) self.assertEqual(x[0], 1L, "Geom in index isn't exact") ix.drop()