~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_rio.py

  • Committer: Martin Pool
  • Date: 2006-02-22 07:05:44 UTC
  • mto: This revision was merged to the branch mainline in revision 1569.
  • Revision ID: mbp@sourcefrog.net-20060222070544-f7808ac1678c0ec8
rio files are always externalized in utf-8.  test this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
but this depends on the transport.
23
23
"""
24
24
 
 
25
import cStringIO
25
26
import os
26
27
import sys
27
28
from tempfile import TemporaryFile
296
297
        """TypeError on adding invalid type to Stanza"""
297
298
        s = Stanza()
298
299
        self.assertRaises(TypeError, s.add, 10, {})
 
300
 
 
301
    def test_rio_unicode(self):
 
302
        # intentionally use cStringIO which doesn't accomodate unencoded unicode objects
 
303
        sio = cStringIO.StringIO()
 
304
        uni_data = u'\N{KATAKANA LETTER O}'
 
305
        s = Stanza(foo=uni_data)
 
306
        self.assertEquals(s.get('foo'), uni_data)
 
307
        raw_lines = s.to_lines()
 
308
        self.assertEquals(raw_lines,
 
309
                ['foo: ' + uni_data.encode('utf-8') + '\n'])
 
310
        new_s = read_stanza(raw_lines)
 
311
        self.assertEquals(new_s.get('foo'), uni_data)
 
312