~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

  • Committer: John Arbash Meinel
  • Date: 2007-03-02 17:09:40 UTC
  • mto: This revision was merged to the branch mainline in revision 2321.
  • Revision ID: john@arbash-meinel.com-20070302170940-52wmugtm01zpzma2
Update VersionedFile tests to ensure that they can take Unicode,
but issue a warning when doing so.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import bzrlib
27
27
from bzrlib import (
28
28
    errors,
 
29
    osutils,
29
30
    progress,
30
31
    )
31
32
from bzrlib.errors import (
672
673
        parent_id_unicode = u'b\xbfse'
673
674
        parent_id_utf8 = parent_id_unicode.encode('utf8')
674
675
        try:
675
 
            vf.add_lines_with_ghosts(u'notbxbfse', [parent_id_utf8], [])
 
676
            vf.add_lines_with_ghosts('notbxbfse', [parent_id_utf8], [])
676
677
        except NotImplementedError:
677
678
            # check the other ghost apis are also not implemented
678
679
            self.assertRaises(NotImplementedError, vf.has_ghost, 'foo')
687
688
        self.assertEqual(['notbxbfse'], vf.get_ancestry('notbxbfse'))
688
689
        self.assertEqual([], vf.get_parents('notbxbfse'))
689
690
        self.assertEqual({'notbxbfse':[]}, vf.get_graph())
690
 
        self.assertFalse(vf.has_version(parent_id_unicode))
 
691
        self.assertFalse(self.callDeprecated([osutils._revision_id_warning],
 
692
                         vf.has_version, parent_id_unicode))
691
693
        self.assertFalse(vf.has_version(parent_id_utf8))
692
694
        # we have _with_ghost apis to give us ghost information.
693
695
        self.assertEqual([parent_id_utf8, 'notbxbfse'], vf.get_ancestry_with_ghosts(['notbxbfse']))
694
696
        self.assertEqual([parent_id_utf8], vf.get_parents_with_ghosts('notbxbfse'))
695
697
        self.assertEqual({'notbxbfse':[parent_id_utf8]}, vf.get_graph_with_ghosts())
696
 
        self.assertTrue(vf.has_ghost(parent_id_unicode))
 
698
        self.assertTrue(self.callDeprecated([osutils._revision_id_warning],
 
699
                        vf.has_ghost, parent_id_unicode))
697
700
        self.assertTrue(vf.has_ghost(parent_id_utf8))
698
701
        # if we add something that is a ghost of another, it should correct the
699
702
        # results of the prior apis
700
 
        vf.add_lines(parent_id_unicode, [], [])
 
703
        self.callDeprecated([osutils._revision_id_warning],
 
704
                            vf.add_lines, parent_id_unicode, [], [])
701
705
        self.assertEqual([parent_id_utf8, 'notbxbfse'], vf.get_ancestry(['notbxbfse']))
702
706
        self.assertEqual([parent_id_utf8], vf.get_parents('notbxbfse'))
703
707
        self.assertEqual({parent_id_utf8:[],
704
708
                          'notbxbfse':[parent_id_utf8],
705
709
                          },
706
710
                         vf.get_graph())
707
 
        self.assertTrue(vf.has_version(parent_id_unicode))
 
711
        self.assertTrue(self.callDeprecated([osutils._revision_id_warning],
 
712
                        vf.has_version, parent_id_unicode))
708
713
        self.assertTrue(vf.has_version(parent_id_utf8))
709
714
        # we have _with_ghost apis to give us ghost information.
710
715
        self.assertEqual([parent_id_utf8, 'notbxbfse'], vf.get_ancestry_with_ghosts(['notbxbfse']))
713
718
                          'notbxbfse':[parent_id_utf8],
714
719
                          },
715
720
                         vf.get_graph_with_ghosts())
716
 
        self.assertFalse(vf.has_ghost(parent_id_unicode))
 
721
        self.assertFalse(self.callDeprecated([osutils._revision_id_warning],
 
722
                         vf.has_ghost, parent_id_unicode))
717
723
        self.assertFalse(vf.has_ghost(parent_id_utf8))
718
724
 
719
725
    def test_add_lines_with_ghosts_after_normal_revs(self):