~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_generate_ids.py

  • Committer: Patch Queue Manager
  • Date: 2016-04-21 04:10:52 UTC
  • mfrom: (6616.1.1 fix-en-user-guide)
  • Revision ID: pqm@pqm.ubuntu.com-20160421041052-clcye7ns1qcl2n7w
(richard-wilbur) Ensure build of English use guide always uses English text
 even when user's locale specifies a different language. (Jelmer Vernooij)

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+'