~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_cache_utf8.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-11 00:23:23 UTC
  • mfrom: (2070 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2071.
  • Revision ID: john@arbash-meinel.com-20061011002323-82ba88c293d7caff
[merge] bzr.dev 2070

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, 0), cache_utf8._utf8_decode_with_None(None))
 
81
        self.failUnless(xp is x)
 
82
        self.failUnless(xp is yp)
 
83