~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testidentitymap.py

  • Committer: abentley
  • Date: 2005-10-14 03:50:50 UTC
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1460.
  • Revision ID: abentley@lappy-20051014035050-d779472ccb599a51
semi-broke merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005 by Canonical Ltd
2
2
#   Authors: Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
21
21
 
22
22
#import bzrlib specific imports here
23
23
import bzrlib.errors as errors
24
 
from bzrlib.tests import TestCase
 
24
from bzrlib.selftest import TestCase
25
25
import bzrlib.identitymap as identitymap
26
26
 
27
27
 
52
52
        map.add_weave("id", weave)
53
53
        map.remove_object(weave)
54
54
        map.add_weave("id", weave)
 
55
        rev_history = [1]
 
56
        map.add_revision_history(rev_history)
 
57
        map.remove_object(rev_history)
 
58
 
 
59
    def test_add_revision_history(self):
 
60
        map = identitymap.IdentityMap()
 
61
        rev_history = [1,2,3]
 
62
        map.add_revision_history(rev_history)
 
63
        self.assertEqual(rev_history, map.find_revision_history())
 
64
 
 
65
    def test_double_add_revision_history(self):
 
66
        map = identitymap.IdentityMap()
 
67
        revision_history = [1]
 
68
        map.add_revision_history(revision_history)
 
69
        self.assertRaises(errors.BzrError,
 
70
                          map.add_revision_history,
 
71
                          revision_history)
 
72
        self.assertEqual(revision_history, map.find_revision_history())
55
73
 
56
74
 
57
75
class TestNullIdentityMap(TestCase):
79
97
        map = identitymap.NullIdentityMap()
80
98
        self.assertEqual(None, getattr(map, 'remove_object', None))
81
99
 
 
100
    def test_add_revision_history(self):
 
101
        map = identitymap.NullIdentityMap()
 
102
        rev_history = [1,2,3]
 
103
        map.add_revision_history(rev_history)
 
104
        self.assertEqual(None, map.find_revision_history())
 
105
 
 
106
    def test_double_add_revision_history(self):
 
107
        map = identitymap.NullIdentityMap()
 
108
        revision_history = [1]
 
109
        map.add_revision_history(revision_history)
 
110
        map.add_revision_history(revision_history)
 
111
        self.assertEqual(None, map.find_revision_history())