~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_weave.py

  • Committer: Vincent Ladeuil
  • Date: 2017-01-17 13:48:10 UTC
  • mfrom: (6615.3.6 merges)
  • mto: This revision was merged to the branch mainline in revision 6620.
  • Revision ID: v.ladeuil+lp@free.fr-20170117134810-j9p3lidfy6pfyfsc
Merge 2.7, resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005-2011, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
28
28
    )
29
29
from bzrlib.osutils import sha_string
30
30
from bzrlib.tests import TestCase, TestCaseInTempDir
31
 
from bzrlib.weave import Weave, WeaveFormatError, WeaveError
 
31
from bzrlib.weave import Weave, WeaveFormatError
32
32
from bzrlib.weavefile import write_weave, read_weave
33
33
 
34
34
 
64
64
 
65
65
class WeaveContains(TestBase):
66
66
    """Weave __contains__ operator"""
 
67
 
67
68
    def runTest(self):
68
69
        k = Weave(get_scope=lambda:None)
69
70
        self.assertFalse('foo' in k)
72
73
 
73
74
 
74
75
class Easy(TestBase):
 
76
 
75
77
    def runTest(self):
76
78
        k = Weave()
77
79
 
78
80
 
79
81
class AnnotateOne(TestBase):
 
82
 
80
83
    def runTest(self):
81
84
        k = Weave()
82
85
        k.add_lines('text0', [], TEXT_0)
86
89
 
87
90
class InvalidAdd(TestBase):
88
91
    """Try to use invalid version number during add."""
 
92
 
89
93
    def runTest(self):
90
94
        k = Weave()
91
95
 
107
111
 
108
112
 
109
113
class InvalidRepeatedAdd(TestBase):
 
114
 
110
115
    def runTest(self):
111
116
        k = Weave()
112
117
        k.add_lines('basis', [], TEXT_0)
533
538
 
534
539
class Merge(TestBase):
535
540
    """Storage of versions that merge diverged parents"""
 
541
 
536
542
    def runTest(self):
537
543
        k = Weave()
538
544
 
582
588
 
583
589
        merged = k.merge([1, 2])
584
590
 
585
 
        self.assertEquals([[['aaa']],
 
591
        self.assertEqual([[['aaa']],
586
592
                           [['111'], ['222']],
587
593
                           [['bbb']]])
588
594
 
649
655
 
650
656
 
651
657
class JoinWeavesTests(TestBase):
 
658
 
652
659
    def setUp(self):
653
660
        super(JoinWeavesTests, self).setUp()
654
661
        self.weave1 = Weave()
674
681
        write_weave(w, tmpf)
675
682
 
676
683
        # Because we are corrupting, we need to make sure we have the exact text
677
 
        self.assertEquals('# bzr weave file v5\n'
 
684
        self.assertEqual('# bzr weave file v5\n'
678
685
                          'i\n1 f572d396fae9206628714fb2ce00f72e94f2258f\nn v1\n\n'
679
686
                          'i 0\n1 90f265c6e75f1c8f9ab76dcf85528352c5f215ef\nn v2\n\n'
680
687
                          'w\n{ 0\n. hello\n}\n{ 1\n. there\n}\nW\n',