/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: 2017-11-21 20:14:44 UTC
  • mfrom: (6821.1.1 ignore-warnings)
  • Revision ID: jelmer@jelmer.uk-20171121201444-dvb7yjku3zwjev83
Merge lp:~jelmer/brz/ignore-warnings.

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
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
"""Tests for bzrlib/generate_ids.py"""
18
 
 
19
 
import re
20
 
 
21
 
from bzrlib import (
 
17
"""Tests for breezy/generate_ids.py"""
 
18
 
 
19
from .. import (
22
20
    generate_ids,
23
21
    tests,
24
22
    )
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+'
132
130
    def test_gen_revision_id_email(self):
133
131
        """gen_revision_id uses email address if present"""
134
132
        regex = r'user\+joe_bar@foo-bar\.com-\d{14}-[a-z0-9]{16}'
135
 
        self.assertGenRevisionId(regex,'user+joe_bar@foo-bar.com')
 
133
        self.assertGenRevisionId(regex, 'user+joe_bar@foo-bar.com')
136
134
        self.assertGenRevisionId(regex, '<user+joe_bar@foo-bar.com>')
137
135
        self.assertGenRevisionId(regex, 'Joe Bar <user+joe_bar@foo-bar.com>')
138
136
        self.assertGenRevisionId(regex, 'Joe Bar <user+Joe_Bar@Foo-Bar.com>')