941
941
self.assertEqualDiff(''.join(k.get_lines('text-1a')), TEXT_1A)
942
942
# check the index had the right data added.
943
943
self.assertEqual(set([
944
('text-1', ((), ()), ' 0 127'),
945
('text-1a', (('text-1',), ('text-1',)), ' 127 140'),
944
('text-1', ' 0 127', ((), ())),
945
('text-1a', ' 127 140', (('text-1',), ('text-1',))),
946
946
]), set(index.iter_all_entries()))
947
947
# we should not have a .kndx file
948
948
self.assertFalse(get_transport('.').has('test.kndx'))
1546
1546
# build a complex graph across several indices.
1548
1548
index1 = self.make_g_index('1', 2, [
1549
('tip', (['parent'], [], ), 'N0 100'),
1550
('tail', ([], []), '')])
1549
('tip', 'N0 100', (['parent'], [], )),
1550
('tail', '', ([], []))])
1551
1551
index2 = self.make_g_index('2', 2, [
1552
('parent', (['tail', 'ghost'], ['tail']), ' 100 78'),
1553
('separate', ([], []), '')])
1552
('parent', ' 100 78', (['tail', 'ghost'], ['tail'])),
1553
('separate', '', ([], []))])
1555
1555
index1 = self.make_g_index('1', 1, [
1556
('tip', (['parent'], ), 'N0 100'),
1557
('tail', ([], ), '')])
1556
('tip', 'N0 100', (['parent'], )),
1557
('tail', '', ([], ))])
1558
1558
index2 = self.make_g_index('2', 1, [
1559
('parent', (['tail', 'ghost'], ), ' 100 78'),
1560
('separate', ([], ), '')])
1559
('parent', ' 100 78', (['tail', 'ghost'], )),
1560
('separate', '', ([], ))])
1561
1561
combined_index = CombinedGraphIndex([index1, index2])
1563
1563
self.combined_index = combined_index
1706
1706
def test_add_version_smoke(self):
1707
1707
index = self.two_graph_index(catch_adds=True)
1708
1708
index.add_version('new', 'fulltext,no-eol', 50, 60, ['separate'])
1709
self.assertEqual([[('new', (('separate',),), 'N50 60')]],
1709
self.assertEqual([[('new', 'N50 60', (('separate',),))]],
1710
1710
self.caught_entries)
1712
1712
def test_add_version_delta_not_delta_index(self):
1748
1748
('new', 'fulltext,no-eol', 50, 60, ['separate']),
1749
1749
('new2', 'fulltext', 0, 6, ['new']),
1751
self.assertEqual([('new', (('separate',),), 'N50 60'),
1752
('new2', (('new',),), ' 0 6')],
1751
self.assertEqual([('new', 'N50 60', (('separate',),)),
1752
('new2', ' 0 6', (('new',),))],
1753
1753
sorted(self.caught_entries[0]))
1754
1754
self.assertEqual(1, len(self.caught_entries))
1759
1759
('new', 'fulltext,no-eol', 50, 60, ['separate']),
1760
1760
('new2', 'line-delta', 0, 6, ['new']),
1762
self.assertEqual([('new', (('separate',), ()), 'N50 60'),
1763
('new2', (('new',), ('new',), ), ' 0 6')],
1762
self.assertEqual([('new', 'N50 60', (('separate',), ())),
1763
('new2', ' 0 6', (('new',), ('new',), ))],
1764
1764
sorted(self.caught_entries[0]))
1765
1765
self.assertEqual(1, len(self.caught_entries))