~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_cache_utf8.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-08-17 07:52:09 UTC
  • mfrom: (1910.3.4 trivial)
  • Revision ID: pqm@pqm.ubuntu.com-20060817075209-e85a1f9e05ff8b87
(andrew) Trivial fixes to NotImplemented errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
        xp = cache_utf8.get_cached_unicode(x)
79
79
        yp = cache_utf8.get_cached_unicode(y)
80
80
 
81
 
        self.assertIs(xp, x)
82
 
        self.assertIs(xp, yp)
83
 
 
84
 
    def test_cached_utf8(self):
85
 
        x = u'\xb5yy\xe5zz'.encode('utf8')
86
 
        y = u'\xb5yy\xe5zz'.encode('utf8')
87
 
        self.failIf(x is y)
88
 
        xp = cache_utf8.get_cached_utf8(x)
89
 
        yp = cache_utf8.get_cached_utf8(y)
90
 
 
91
 
        self.assertIs(xp, x)
92
 
        self.assertIs(xp, yp)
93
 
 
94
 
    def test_cached_ascii(self):
95
 
        x = '%s %s' % ('simple', 'text')
96
 
        y = '%s %s' % ('simple', 'text')
97
 
        self.failIf(x is y)
98
 
        xp = cache_utf8.get_cached_ascii(x)
99
 
        yp = cache_utf8.get_cached_ascii(y)
100
 
 
101
 
        self.assertIs(xp, x)
102
 
        self.assertIs(xp, yp)
103
 
 
104
 
        # after caching, encode and decode should also return the right
105
 
        # objects.
106
 
        uni_x = cache_utf8.decode(x)
107
 
        self.assertEqual(u'simple text', uni_x)
108
 
        self.assertIsInstance(uni_x, unicode)
109
 
 
110
 
        utf8_x = cache_utf8.encode(uni_x)
111
 
        self.assertIs(utf8_x, x)
112
 
 
113
 
    def test_decode_with_None(self):
114
 
        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'f\xb5',
117
 
                         cache_utf8._utf8_decode_with_None('f\xc2\xb5'))
 
81
        self.failUnless(xp is x)
 
82
        self.failUnless(xp is yp)
 
83