/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_cache_utf8.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-06 01:18:08 UTC
  • mfrom: (7143 work)
  • mto: This revision was merged to the branch mainline in revision 7151.
  • Revision ID: jelmer@jelmer.uk-20181106011808-y870f4vq0ork3ahu
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from .. import (
20
20
    cache_utf8,
21
21
    )
 
22
from ..sixish import text_type
22
23
from . import TestCase
23
24
 
24
25
 
92
93
        self.assertIs(xp, yp)
93
94
 
94
95
    def test_cached_ascii(self):
95
 
        x = '%s %s' % ('simple', 'text')
96
 
        y = '%s %s' % ('simple', 'text')
97
 
        self.assertFalse(x is y)
 
96
        x = b'%s %s' % (b'simple', b'text')
 
97
        y = b'%s %s' % (b'simple', b'text')
 
98
        self.assertIsNot(x, y)
98
99
        xp = cache_utf8.get_cached_ascii(x)
99
100
        yp = cache_utf8.get_cached_ascii(y)
100
101
 
105
106
        # objects.
106
107
        uni_x = cache_utf8.decode(x)
107
108
        self.assertEqual(u'simple text', uni_x)
108
 
        self.assertIsInstance(uni_x, unicode)
 
109
        self.assertIsInstance(uni_x, text_type)
109
110
 
110
111
        utf8_x = cache_utf8.encode(uni_x)
111
112
        self.assertIs(utf8_x, x)
112
113
 
113
114
    def test_decode_with_None(self):
114
115
        self.assertEqual(None, cache_utf8._utf8_decode_with_None(None))
115
 
        self.assertEqual(u'foo', cache_utf8._utf8_decode_with_None('foo'))
 
116
        self.assertEqual(u'foo', cache_utf8._utf8_decode_with_None(b'foo'))
116
117
        self.assertEqual(u'f\xb5',
117
 
                         cache_utf8._utf8_decode_with_None('f\xc2\xb5'))
 
118
                         cache_utf8._utf8_decode_with_None(b'f\xc2\xb5'))