1332
1332
self.assertEqual(res, content_obj.text())
1333
1333
self.assertEqual(res, ann._text_cache[rev_key])
1335
def test__expand_delta_no_parent(self):
1335
def test__expand_delta_comp_parent_not_available(self):
1336
1336
# Parent isn't available yet, so we return nothing, but queue up this
1337
1337
# node for later processing
1338
1338
ann = self.make_annotator()
1348
1348
self.assertEqual(1, len(pending))
1349
1349
self.assertEqual((rev_key, (parent_key,), record, details), pending[0])
1351
def test__expand_delta_right_parent_not_available(self):
1352
ann = self.make_annotator()
1353
rev_key = ('rev-id',)
1356
record = ['0,1,1\n', 'new-line\n']
1357
details = ('line-delta', False)
1358
p1_record = ['line1\n', 'line2\n']
1359
res = ann._expand_record(rev_key, (p1_key,p2_key), p1_key,
1361
self.assertEqual(None, res)
1362
# self.assertTrue(p1_key in ann._pending_deltas)
1363
self.assertEqual({}, ann._pending_annotation)
1364
# Now insert p1, and we should be able to expand the delta
1365
res = ann._expand_record(p1_key, (), None, p1_record,
1366
('fulltext', False))
1367
self.assertEqual(p1_record, res)
1368
ann._annotations_cache[p1_key] = [(p1_key,)]*2
1369
res = ann._process_pending(p1_key)
1370
self.assertFalse(p1_key in ann._pending_deltas)
1371
self.assertTrue(p2_key in ann._pending_annotation)
1372
self.assertEqual({p2_key: [(rev_key, (p1_key, p2_key))]},
1373
ann._pending_annotation)
1374
# Now fill in parent 2, and pending annotation should be satisfied
1375
res = ann._expand_record(p2_key, (), None, [], ('fulltext', False))
1351
1377
def test_record_delta_removes_basis(self):
1352
1378
ann = self.make_annotator()
1353
1379
ann._expand_record(('parent-id',), (), None,