/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_rio.py

  • Committer: Robert Collins
  • Date: 2006-03-03 02:09:49 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060303020949-0ddc6f33d0a43943
Smoke test for RevisionStore factories creating revision stores.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from tempfile import TemporaryFile
29
29
 
30
30
from bzrlib.tests import TestCaseInTempDir, TestCase
31
 
from bzrlib.rio import (RioWriter, Stanza, read_stanza, read_stanzas, rio_file,
32
 
                        RioReader)
 
31
from bzrlib.rio import RioWriter, Stanza, read_stanza, read_stanzas
33
32
 
34
33
 
35
34
class TestRio(TestCase):
158
157
""")
159
158
        s2 = read_stanza(s.to_lines())
160
159
        self.assertEquals(s, s2)
161
 
        self.rio_file_stanzas([s])
162
160
 
163
161
    def test_quoted(self):
164
162
        """rio quoted string cases"""
174
172
                   )
175
173
        s2 = read_stanza(s.to_lines())
176
174
        self.assertEquals(s, s2)
177
 
        # apparent bug in read_stanza
178
 
        # s3 = read_stanza(self.stanzas_to_str([s]))
179
 
        # self.assertEquals(s, s3)
180
175
 
181
176
    def test_read_empty(self):
182
177
        """Detect end of rio file"""
234
229
        self.assertEquals(s, Stanza(name="bar", val='129319'))
235
230
        s = read_stanza(tmpf)
236
231
        self.assertEquals(s, None)
237
 
        self.check_rio_file(tmpf)
238
 
 
239
 
    def check_rio_file(self, real_file):
240
 
        real_file.seek(0)
241
 
        read_write = rio_file(RioReader(real_file)).read()
242
 
        real_file.seek(0)
243
 
        self.assertEquals(read_write, real_file.read())
244
 
 
245
 
    @staticmethod
246
 
    def stanzas_to_str(stanzas):
247
 
        return rio_file(stanzas).read()
248
 
 
249
 
    def rio_file_stanzas(self, stanzas):
250
 
        new_stanzas = list(RioReader(rio_file(stanzas)))
251
 
        self.assertEqual(new_stanzas, stanzas)
252
232
 
253
233
    def test_tricky_quoted(self):
254
234
        tmpf = TemporaryFile()
300
280
            ]
301
281
        for expected in expected_vals:
302
282
            stanza = read_stanza(tmpf)
303
 
            self.rio_file_stanzas([stanza])
304
283
            self.assertEquals(len(stanza), 1)
305
284
            self.assertEqualDiff(stanza.get('s'), expected)
306
285