/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_generate_ids.py

  • Committer: Jelmer Vernooij
  • Date: 2018-08-01 19:37:07 UTC
  • mto: This revision was merged to the branch mainline in revision 7058.
  • Revision ID: jelmer@jelmer.uk-20180801193707-dyecqwo0y2z4cpk9
Fix a few more tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
        The file id should be ascii, and should be an 8-bit string
32
32
        """
33
33
        file_id = generate_ids.gen_file_id(filename)
34
 
        self.assertContainsRe(file_id, '^'+regex+'$')
 
34
        self.assertContainsRe(file_id, b'^'+regex+b'$')
35
35
        # It should be a utf8 file_id, not a unicode one
36
36
        self.assertIsInstance(file_id, str)
37
37
        # gen_file_id should always return ascii file ids.
71
71
        self.assertTrue(len(fid) < 60)
72
72
 
73
73
    def test_file_ids_are_ascii(self):
74
 
        tail = r'-\d{14}-[a-z0-9]{16}-\d+'
75
 
        self.assertGenFileId('foo' + tail, 'foo')
76
 
        self.assertGenFileId('foo' + tail, u'foo')
77
 
        self.assertGenFileId('bar' + tail, u'bar')
78
 
        self.assertGenFileId('br' + tail, u'b\xe5r')
 
74
        tail = br'-\d{14}-[a-z0-9]{16}-\d+'
 
75
        self.assertGenFileId(b'foo' + tail, b'foo')
 
76
        self.assertGenFileId(b'foo' + tail, u'foo')
 
77
        self.assertGenFileId(b'bar' + tail, u'bar')
 
78
        self.assertGenFileId(b'br' + tail, u'b\xe5r')
79
79
 
80
80
    def test__next_id_suffix_sets_suffix(self):
81
81
        generate_ids._gen_file_id_suffix = None