~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_graph.py

  • Committer: Martin Pool
  • Date: 2010-09-13 08:55:08 UTC
  • mfrom: (5417.1.5 scripts)
  • mto: This revision was merged to the branch mainline in revision 5426.
  • Revision ID: mbp@sourcefrog.net-20100913085508-oz74wnsz53hjd4yf
Merge additional fixes for blank lines in scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1424
1424
        self.assertMergeOrder(['rev3', 'rev1'], graph, 'rev4', ['rev1', 'rev3'])
1425
1425
 
1426
1426
 
1427
 
class TestFindDescendants(TestGraphBase):
1428
 
 
1429
 
    def test_find_descendants_rev1_rev3(self):
1430
 
        graph = self.make_graph(ancestry_1)
1431
 
        descendants = graph.find_descendants('rev1', 'rev3')
1432
 
        self.assertEqual(set(['rev1', 'rev2a', 'rev3']), descendants)
1433
 
 
1434
 
    def test_find_descendants_rev1_rev4(self):
1435
 
        graph = self.make_graph(ancestry_1)
1436
 
        descendants = graph.find_descendants('rev1', 'rev4')
1437
 
        self.assertEqual(set(['rev1', 'rev2a', 'rev2b', 'rev3', 'rev4']),
1438
 
                         descendants)
1439
 
 
1440
 
    def test_find_descendants_rev2a_rev4(self):
1441
 
        graph = self.make_graph(ancestry_1)
1442
 
        descendants = graph.find_descendants('rev2a', 'rev4')
1443
 
        self.assertEqual(set(['rev2a', 'rev3', 'rev4']), descendants)
1444
 
 
1445
 
class TestFindLefthandMerger(TestGraphBase):
1446
 
 
1447
 
    def check_merger(self, result, ancestry, merged, tip):
1448
 
        graph = self.make_graph(ancestry)
1449
 
        self.assertEqual(result, graph.find_lefthand_merger(merged, tip))
1450
 
 
1451
 
    def test_find_lefthand_merger_rev2b(self):
1452
 
        self.check_merger('rev4', ancestry_1, 'rev2b', 'rev4')
1453
 
 
1454
 
    def test_find_lefthand_merger_rev2a(self):
1455
 
        self.check_merger('rev2a', ancestry_1, 'rev2a', 'rev4')
1456
 
 
1457
 
    def test_find_lefthand_merger_rev4(self):
1458
 
        self.check_merger(None, ancestry_1, 'rev4', 'rev2a')
1459
 
 
1460
 
    def test_find_lefthand_merger_f(self):
1461
 
        self.check_merger('i', complex_shortcut, 'f', 'm')
1462
 
 
1463
 
    def test_find_lefthand_merger_g(self):
1464
 
        self.check_merger('i', complex_shortcut, 'g', 'm')
1465
 
 
1466
 
    def test_find_lefthand_merger_h(self):
1467
 
        self.check_merger('n', complex_shortcut, 'h', 'n')
1468
 
 
1469
 
 
1470
 
class TestGetChildMap(TestGraphBase):
1471
 
 
1472
 
    def test_get_child_map(self):
1473
 
        graph = self.make_graph(ancestry_1)
1474
 
        child_map = graph.get_child_map(['rev4', 'rev3', 'rev2a', 'rev2b'])
1475
 
        self.assertEqual({'rev1': ['rev2a', 'rev2b'],
1476
 
                          'rev2a': ['rev3'],
1477
 
                          'rev2b': ['rev4'],
1478
 
                          'rev3': ['rev4']},
1479
 
                          child_map)
1480
 
 
1481
 
 
1482
1427
class TestCachingParentsProvider(tests.TestCase):
1483
1428
    """These tests run with:
1484
1429