/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: 2017-06-08 23:30:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6690.
  • Revision ID: jelmer@jelmer.uk-20170608233031-3qavls2o7a1pqllj
Update imports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        self.check_decode(u'some_\xb5_unicode_\xe5_chars')
73
73
 
74
74
    def test_cached_unicode(self):
75
 
        # Note that this is intentionally split, to prevent Python from
76
 
        # assigning x and y to the same object
77
 
        z = u'\xe5zz'
78
 
        x = u'\xb5yy' + z
79
 
        y = u'\xb5yy' + z
80
 
        self.assertIsNot(x, y)
 
75
        x = u'\xb5yy' + u'\xe5zz'
 
76
        y = u'\xb5yy' + u'\xe5zz'
 
77
        self.assertFalse(x is y)
81
78
        xp = cache_utf8.get_cached_unicode(x)
82
79
        yp = cache_utf8.get_cached_unicode(y)
83
80
 
95
92
        self.assertIs(xp, yp)
96
93
 
97
94
    def test_cached_ascii(self):
98
 
        x = b'%s %s' % (b'simple', b'text')
99
 
        y = b'%s %s' % (b'simple', b'text')
100
 
        self.assertIsNot(x, y)
 
95
        x = '%s %s' % ('simple', 'text')
 
96
        y = '%s %s' % ('simple', 'text')
 
97
        self.assertFalse(x is y)
101
98
        xp = cache_utf8.get_cached_ascii(x)
102
99
        yp = cache_utf8.get_cached_ascii(y)
103
100
 
108
105
        # objects.
109
106
        uni_x = cache_utf8.decode(x)
110
107
        self.assertEqual(u'simple text', uni_x)
111
 
        self.assertIsInstance(uni_x, str)
 
108
        self.assertIsInstance(uni_x, unicode)
112
109
 
113
110
        utf8_x = cache_utf8.encode(uni_x)
114
111
        self.assertIs(utf8_x, x)
115
112
 
116
113
    def test_decode_with_None(self):
117
114
        self.assertEqual(None, cache_utf8._utf8_decode_with_None(None))
118
 
        self.assertEqual(u'foo', cache_utf8._utf8_decode_with_None(b'foo'))
 
115
        self.assertEqual(u'foo', cache_utf8._utf8_decode_with_None('foo'))
119
116
        self.assertEqual(u'f\xb5',
120
 
                         cache_utf8._utf8_decode_with_None(b'f\xc2\xb5'))
 
117
                         cache_utf8._utf8_decode_with_None('f\xc2\xb5'))