def test_batch_deletes(self): idx = IntRtreeIndex() additions1 = [ {'id': '1', 'bbox': (0, 0, 0, 0), 't': 'One'}, {'id': '2', 'geometry': {'type': 'Point', 'coordinates': (0.0, 0.0)}, 't': 'Two'}] set1 = ChangeSet(additions=additions1) self.assertEquals(idx.batch(set1), None) additions2 = [ {'id': '3', 'geometry': {'type': 'Point', 'coordinates': (10.01, 10.01)}, 't': 'Three'}] deletions2 = [{'id': '1', 'bbox': (0, 0, 0, 0)}] set2 = ChangeSet(additions2, deletions2) self.assertEquals(idx.batch(set2), None) self.assertEquals(list(idx.intersection((-0.1, -0.1, 1.1, 1.1))), [{'geometry': {'type': 'Point', 'coordinates': (0.0, 0.0)}, 'id': '2', 'bbox': (0.0, 0.0, 0.0, 0.0), 't': 'Two'}]) self.assertEquals(list(idx.nearest((9.0, 9.0, 9.1, 9.1))), [{'geometry': {'type': 'Point', 'coordinates': (10.01, 10.01)}, 'id': '3', 'bbox': (10.01, 10.01, 10.01, 10.01), 't': 'Three'}])
def test_batch_empty(self): idx = IntRtreeIndex() set = ChangeSet() self.assertEquals(idx.batch(set), None)