~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_rio.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-22 19:37:57 UTC
  • mto: This revision was merged to the branch mainline in revision 2032.
  • Revision ID: john@arbash-meinel.com-20060922193757-a8341ac119f0d33c
Create a 'read_stanza_unicode' to handle unicode processing

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import sys
28
28
from tempfile import TemporaryFile
29
29
 
 
30
from bzrlib import (
 
31
    rio,
 
32
    )
30
33
from bzrlib.tests import TestCaseInTempDir, TestCase
31
34
from bzrlib.rio import (RioWriter, Stanza, read_stanza, read_stanzas, rio_file,
32
35
                        RioReader)
332
335
    def test_rio_to_unicode(self):
333
336
        uni_data = u'\N{KATAKANA LETTER O}'
334
337
        s = Stanza(foo=uni_data)
335
 
        self.assertEqual(u'foo: %s\n' % (uni_data,), s.to_unicode())
 
338
        unicode_str = s.to_unicode()
 
339
        self.assertEqual(u'foo: %s\n' % (uni_data,), unicode_str)
 
340
        new_s = rio.read_stanza_unicode(unicode_str.splitlines(True))
 
341
        self.assertEqual(uni_data, new_s.get('foo'))
336
342
 
337
343
    def test_nested_rio_unicode(self):
338
344
        uni_data = u'\N{KATAKANA LETTER O}'
345
351
        new_parent = read_stanza(raw_lines)
346
352
        child_text = new_parent.get('child')
347
353
        self.assertEqual(u'foo: %s\n' % uni_data, child_text)
348
 
        new_child = read_stanza(child_text.splitlines(True))
 
354
        new_child = rio.read_stanza_unicode(child_text.splitlines(True))
349
355
        self.assertEqual(uni_data, new_child.get('foo'))