/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 breezy/tests/test_rio.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-07-20 02:17:05 UTC
  • mfrom: (7518.1.2 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200720021705-5f11tmo1hdqjxm6x
Merge lp:brz/3.1.

Merged from https://code.launchpad.net/~jelmer/brz/merge-3.1/+merge/387628

Show diffs side-by-side

added added

removed removed

Lines of Context:
328
328
        s = Stanza()
329
329
        self.assertRaises(TypeError, s.add, 10, {})
330
330
 
 
331
    def test_rio_surrogateescape(self):
 
332
        raw_bytes = b'\xcb'
 
333
        self.assertRaises(UnicodeDecodeError, raw_bytes.decode, 'utf-8')
 
334
        try:
 
335
            uni_data = raw_bytes.decode('utf-8', 'surrogateescape')
 
336
        except LookupError:
 
337
            self.skipTest('surrogateescape is not available on Python < 3')
 
338
        s = Stanza(foo=uni_data)
 
339
        self.assertEqual(s.get('foo'), uni_data)
 
340
        raw_lines = s.to_lines()
 
341
        self.assertEqual(raw_lines,
 
342
                         [b'foo: ' + uni_data.encode('utf-8', 'surrogateescape') + b'\n'])
 
343
        new_s = read_stanza(raw_lines)
 
344
        self.assertEqual(new_s.get('foo'), uni_data)
 
345
 
331
346
    def test_rio_unicode(self):
332
347
        uni_data = u'\N{KATAKANA LETTER O}'
333
348
        s = Stanza(foo=uni_data)