~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_store.py

(gz) Fix test failure on alpha by correcting format string for
 gc_chk_sha1_record (Martin [gz])

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
class TestCompressedTextStore(TestCaseInTempDir, TestStores):
83
83
 
84
84
    def get_store(self, path=u'.'):
85
 
        t = transport.get_transport_from_path(path)
 
85
        t = transport.get_transport(path)
86
86
        return TextStore(t, compressed=True)
87
87
 
88
88
    def test_total_size(self):
116
116
 
117
117
    def test_missing_is_absent(self):
118
118
        store = self.get_store()
119
 
        self.assertFalse('aa' in store)
 
119
        self.failIf('aa' in store)
120
120
 
121
121
    def test_adding_fails_when_present(self):
122
122
        my_store = self.get_store()
139
139
class TestTextStore(TestCaseInTempDir, TestStores):
140
140
 
141
141
    def get_store(self, path=u'.'):
142
 
        t = transport.get_transport_from_path(path)
 
142
        t = transport.get_transport(path)
143
143
        return TextStore(t, compressed=False)
144
144
 
145
145
    def test_total_size(self):
157
157
class TestMixedTextStore(TestCaseInTempDir, TestStores):
158
158
 
159
159
    def get_store(self, path=u'.', compressed=True):
160
 
        t = transport.get_transport_from_path(path)
 
160
        t = transport.get_transport(path)
161
161
        return TextStore(t, compressed=compressed)
162
162
 
163
163
    def test_get_mixed(self):
165
165
        s = self.get_store(u'.', compressed=False)
166
166
        cs.add(StringIO('hello there'), 'a')
167
167
 
168
 
        self.assertPathExists('a.gz')
169
 
        self.assertFalse(os.path.lexists('a'))
 
168
        self.failUnlessExists('a.gz')
 
169
        self.failIf(os.path.lexists('a'))
170
170
 
171
171
        self.assertEquals(gzip.GzipFile('a.gz').read(), 'hello there')
172
172
 
178
178
        self.assertRaises(BzrError, s.add, StringIO('goodbye'), 'a')
179
179
 
180
180
        s.add(StringIO('goodbye'), 'b')
181
 
        self.assertPathExists('b')
182
 
        self.assertFalse(os.path.lexists('b.gz'))
 
181
        self.failUnlessExists('b')
 
182
        self.failIf(os.path.lexists('b.gz'))
183
183
        self.assertEquals(open('b').read(), 'goodbye')
184
184
 
185
185
        self.assertEquals(cs.has_id('b'), True)
230
230
class TestMockTransport(TestCase):
231
231
 
232
232
    def test_isinstance(self):
233
 
        self.assertIsInstance(MockTransport(), transport.Transport)
 
233
        self.failUnless(isinstance(MockTransport(), transport.Transport))
234
234
 
235
235
    def test_has(self):
236
236
        self.assertEqual(False, MockTransport().has('foo'))