~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transactions.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-03-11 13:47:06 UTC
  • mfrom: (5051.3.16 use-branch-open)
  • Revision ID: pqm@pqm.ubuntu.com-20100311134706-kaerqhx3lf7xn6rh
(Jelmer) Pass colocated branch names further down the call stack.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
"""Tests for the behaviour of the Transaction concept in bzr."""
19
19
 
60
60
        self.transaction.register_clean("anobject")
61
61
 
62
62
    def test_register_dirty_raises(self):
63
 
        self.assertRaises(errors.ReadOnlyError, 
 
63
        self.assertRaises(errors.ReadOnlyError,
64
64
                          self.transaction.register_dirty,"anobject")
65
 
    
 
65
 
66
66
    def test_map(self):
67
67
        self.assertNotEqual(None, getattr(self.transaction, "map", None))
68
 
    
 
68
 
69
69
    def test_add_and_get(self):
70
70
        weave = "a weave"
71
71
        self.transaction.map.add_weave("id", weave)
99
99
        # its not a weakref system
100
100
        self.assertEqual(DummyWeave("another weave"),
101
101
                         self.transaction.map.find_weave("id"))
102
 
        
 
102
 
103
103
    def test_small_cache(self):
104
104
        self.transaction.set_cache_size(1)
105
105
        # add an object, should not fall right out if there are no references
151
151
    def test_register_clean(self):
152
152
        transaction = transactions.PassThroughTransaction()
153
153
        transaction.register_clean("anobject")
154
 
    
 
154
 
155
155
    def test_register_dirty(self):
156
156
        transaction = transactions.PassThroughTransaction()
157
157
        transaction.register_dirty("anobject")
158
 
    
 
158
 
159
159
    def test_map(self):
160
160
        transaction = transactions.PassThroughTransaction()
161
161
        self.assertNotEqual(None, getattr(transaction, "map", None))
162
 
    
 
162
 
163
163
    def test_add_and_get(self):
164
164
        transaction = transactions.PassThroughTransaction()
165
165
        weave = "a weave"
166
166
        transaction.map.add_weave("id", weave)
167
167
        self.assertEqual(None, transaction.map.find_weave("id"))
168
 
        
 
168
 
169
169
    def test_finish_returns(self):
170
170
        transaction = transactions.PassThroughTransaction()
171
171
        transaction.finish()
189
189
    def test_writable(self):
190
190
        transaction = transactions.PassThroughTransaction()
191
191
        self.assertTrue(transaction.writeable())
192
 
        
 
192
 
193
193
 
194
194
class TestWriteTransaction(TestCase):
195
195
 
199
199
 
200
200
    def test_register_clean(self):
201
201
        self.transaction.register_clean("anobject")
202
 
    
 
202
 
203
203
    def test_register_dirty(self):
204
204
        self.transaction.register_dirty("anobject")
205
 
    
 
205
 
206
206
    def test_map(self):
207
207
        self.assertNotEqual(None, getattr(self.transaction, "map", None))
208
 
    
 
208
 
209
209
    def test_add_and_get(self):
210
210
        weave = "a weave"
211
211
        self.transaction.map.add_weave("id", weave)
212
212
        self.assertEqual(weave, self.transaction.map.find_weave("id"))
213
 
        
 
213
 
214
214
    def test_finish_returns(self):
215
215
        self.transaction.finish()
216
216
 
250
250
        weave = None
251
251
        self.transaction.register_dirty(self.transaction.map.find_weave("id"))
252
252
        self.assertNotEqual(None, self.transaction.map.find_weave("id"))
253
 
    
 
253
 
254
254
    def test_clean_to_dirty(self):
255
255
        # a clean object may become dirty.
256
256
        weave = DummyWeave('A weave')