1471
1471
self.addCleanup(lambda:self.cleanup(files))
1474
def test_add_lines(self):
1475
f = self.get_versionedfiles()
1476
if self.key_length == 1:
1482
key0 = ('fid', 'r0')
1483
key1 = ('fid', 'r1')
1484
key2 = ('fid', 'r2')
1485
keyf = ('fid', 'foo')
1486
f.add_lines(key0, [], ['a\n', 'b\n'])
1488
f.add_lines(key1, [key0], ['b\n', 'c\n'])
1490
f.add_lines(key1, [], ['b\n', 'c\n'])
1492
self.assertTrue(key0 in keys)
1493
self.assertTrue(key1 in keys)
1495
for record in f.get_record_stream([key0, key1], 'unordered', True):
1496
records.append((record.key, record.get_bytes_as('fulltext')))
1498
self.assertEqual([(key0, 'a\nb\n'), (key1, 'b\nc\n')], records)
1500
def test_add_text(self):
1501
f = self.get_versionedfiles()
1502
if self.key_length == 1:
1508
key0 = ('fid', 'r0')
1509
key1 = ('fid', 'r1')
1510
key2 = ('fid', 'r2')
1511
keyf = ('fid', 'foo')
1512
f.add_text(key0, [], 'a\nb\n')
1514
f.add_text(key1, [key0], 'b\nc\n')
1516
f.add_text(key1, [], 'b\nc\n')
1518
self.assertTrue(key0 in keys)
1519
self.assertTrue(key1 in keys)
1521
for record in f.get_record_stream([key0, key1], 'unordered', True):
1522
records.append((record.key, record.get_bytes_as('fulltext')))
1524
self.assertEqual([(key0, 'a\nb\n'), (key1, 'b\nc\n')], records)
1474
1526
def test_annotate(self):
1475
1527
files = self.get_versionedfiles()
1476
1528
self.get_diamond_files(files)