~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revisionnamespaces.py

  • Committer: John Arbash Meinel
  • Date: 2007-03-12 16:29:47 UTC
  • mfrom: (2325.2.5 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 2343.
  • Revision ID: john@arbash-meinel.com-20070312162947-y3a3fjf0iwalwot5
(Marien Zwart) RevisionSpec.from_string() should support Unicode parameters. (especially for revid:)

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
    def assertInHistoryIs(self, exp_revno, exp_revision_id, revision_spec):
68
68
        rev_info = self.get_in_history(revision_spec)
69
69
        self.assertEqual(exp_revno, rev_info.revno,
70
 
                         'Revision spec: %s returned wrong revno: %s != %s'
 
70
                         'Revision spec: %r returned wrong revno: %r != %r'
71
71
                         % (revision_spec, exp_revno, rev_info.revno))
72
72
        self.assertEqual(exp_revision_id, rev_info.rev_id,
73
 
                         'Revision spec: %s returned wrong revision id:'
74
 
                         ' %s != %s'
 
73
                         'Revision spec: %r returned wrong revision id:'
 
74
                         ' %r != %r'
75
75
                         % (revision_spec, exp_revision_id, rev_info.rev_id))
76
76
 
77
77
    def assertInvalid(self, revision_spec, extra=''):
277
277
                                          revision_id='alt_r3')
278
278
        self.assertInHistoryIs(None, 'alt_r3', 'revid:alt_r3')
279
279
 
 
280
    def test_unicode(self):
 
281
        """We correctly convert a unicode ui string to an encoded revid."""
 
282
        revision_id = u'\N{SNOWMAN}'.encode('utf-8')
 
283
        self.tree.commit('unicode', rev_id=revision_id)
 
284
        self.assertInHistoryIs(3, revision_id, u'revid:\N{SNOWMAN}')
 
285
        self.assertInHistoryIs(3, revision_id, 'revid:' + revision_id)
 
286
 
280
287
 
281
288
class TestRevisionSpec_last(TestRevisionSpec):
282
289