~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_xml.py

  • Committer: John Arbash Meinel
  • Date: 2007-02-09 16:48:31 UTC
  • mto: This revision was merged to the branch mainline in revision 2294.
  • Revision ID: john@arbash-meinel.com-20070209164831-w5kk2hhyoprze3fb
When reading XML, always return utf-8 revision ids.

Show diffs side-by-side

added added

removed removed

Lines of Context:
259
259
        txt = s_v5.write_revision_to_string(rev)
260
260
        new_rev = s_v5.read_revision_from_string(txt)
261
261
        self.assertEqual(props, new_rev.properties)
 
262
 
 
263
    def test_revision_ids_are_utf8(self):
 
264
        """Parsed revision_ids should all be utf-8 strings, not unicode."""
 
265
        s_v5 = bzrlib.xml5.serializer_v5
 
266
        rev = s_v5.read_revision_from_string(_revision_v5)
 
267
        self.assertIsInstance(rev.revision_id, str)
 
268
        for parent_id in rev.parent_ids:
 
269
            self.assertIsInstance(parent_id, str)
 
270
 
 
271
        # ie.revision should either be None or a utf-8 revision id
 
272
        inv = s_v5.read_inventory_from_string(_committed_inv_v5)
 
273
        for path, ie in inv.iter_entries():
 
274
            if ie.revision is None:
 
275
                continue
 
276
            self.assertIsInstance(ie.revision, str)