~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testrevision.py

  • Committer: Robert Collins
  • Date: 2005-09-12 12:42:30 UTC
  • mfrom: (1092.2.9)
  • mto: (1092.2.15)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050912124229-abcadea71750e4ab
revision eq operators

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
from bzrlib.selftest import TestCaseInTempDir
 
17
from bzrlib.selftest import TestCaseInTempDir, TestCase
18
18
 
19
19
 
20
20
def make_branches():
177
177
        # create a revision, sign it, apply to the store.
178
178
        pass
179
179
 
 
180
class TestOperators(TestCase):
 
181
 
 
182
    def test___eq__(self):
 
183
        from bzrlib.revision import Revision, RevisionReference
 
184
        revision1 = Revision("invid", "sha", "revid", 100, "boo", "john", [])
 
185
        revision2 = Revision("invid", "sha", "revid", 100, "boo", "john", [])
 
186
        revision3 = Revision("invid", "sha", "rev2id", 100, "bp", "john", 
 
187
                             [RevisionReference("revid")])
 
188
        self.assertEqual(revision1, revision1)
 
189
        self.assertEqual(revision1, revision2)
 
190
        self.assertNotEqual(revision1, revision3)
 
191
        self.assertEqual(revision2, revision1)
 
192
        self.assertEqual(revision2, revision2)
 
193
        self.assertNotEqual(revision2, revision3)
 
194
        self.assertNotEqual(revision3, revision1)
 
195
        self.assertNotEqual(revision3, revision2)
 
196
        self.assertEqual(revision3, revision3)
 
197
 
 
198
    def test__eq__reference(self):
 
199
        from bzrlib.revision import Revision, RevisionReference
 
200
        ref1 = RevisionReference('revid', '1'*40)
 
201
        ref2 = RevisionReference('revid', '1'*40)
 
202
        ref3 = RevisionReference('revid', '2'*40)
 
203
        ref4 = RevisionReference('revid2', '3'*40)
 
204
        self.assertEqual(ref1, ref1)
 
205
        self.assertEqual(ref1, ref2)
 
206
        self.assertNotEqual(ref1, ref3)
 
207
        self.assertNotEqual(ref1, ref4)
 
208
        self.assertEqual(ref2, ref1)
 
209
        self.assertEqual(ref2, ref2)
 
210
        self.assertNotEqual(ref2, ref3)
 
211
        self.assertNotEqual(ref2, ref4)
 
212
        self.assertNotEqual(ref3, ref1)
 
213
        self.assertNotEqual(ref3, ref2)
 
214
        self.assertEqual(ref3, ref3)
 
215
        self.assertNotEqual(ref3, ref4)
 
216
        self.assertNotEqual(ref4, ref1)
 
217
        self.assertNotEqual(ref4, ref2)
 
218
        self.assertNotEqual(ref4, ref3)
 
219
        self.assertEqual(ref4, ref4)