~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_generate_ids.py

  • Committer: Vincent Ladeuil
  • Date: 2017-01-17 13:48:10 UTC
  • mfrom: (6615.3.6 merges)
  • mto: This revision was merged to the branch mainline in revision 6620.
  • Revision ID: v.ladeuil+lp@free.fr-20170117134810-j9p3lidfy6pfyfsc
Merge 2.7, resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""Tests for bzrlib/generate_ids.py"""
18
18
 
19
 
import re
20
 
 
21
19
from bzrlib import (
22
20
    generate_ids,
23
21
    tests,
64
62
        # Test both case squashing and length restriction
65
63
        fid = gen_file_id('A'*50 + '.txt')
66
64
        self.assertStartsWith(fid, 'a'*20 + '-')
67
 
        self.failUnless(len(fid) < 60)
 
65
        self.assertTrue(len(fid) < 60)
68
66
 
69
67
        # restricting length happens after the other actions, so
70
68
        # we preserve as much as possible
71
69
        fid = gen_file_id('\xe5\xb5..aBcd\tefGhijKLMnop\tqrstuvwxyz')
72
70
        self.assertStartsWith(fid, 'abcdefghijklmnopqrst-')
73
 
        self.failUnless(len(fid) < 60)
 
71
        self.assertTrue(len(fid) < 60)
74
72
 
75
73
    def test_file_ids_are_ascii(self):
76
74
        tail = r'-\d{14}-[a-z0-9]{16}-\d+'