/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.358.2 by Jelmer Vernooij
Refresh copyright headers, add my email.
1
# Copyright (C) 2010-2018 Jelmer Vernooij <jelmer@jelmer.uk>
0.200.1007 by Jelmer Vernooij
Support non-ascii characters in tag names.
2
# vim: encoding=utf-8
0.200.872 by Jelmer Vernooij
Move refs code to separate module.
3
#
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
0.358.1 by Jelmer Vernooij
Fix FSF address.
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0.200.872 by Jelmer Vernooij
Move refs code to separate module.
17
18
19
"""Tests for ref handling."""
20
0.358.3 by Jelmer Vernooij
Enable absolute import.
21
from __future__ import absolute_import
22
0.200.1642 by Jelmer Vernooij
Use relative imports in tests.
23
from .... import tests
0.200.872 by Jelmer Vernooij
Move refs code to separate module.
24
0.200.1642 by Jelmer Vernooij
Use relative imports in tests.
25
from ...git import refs
0.200.872 by Jelmer Vernooij
Move refs code to separate module.
26
27
28
class BranchNameRefConversionTests(tests.TestCase):
29
30
    def test_head(self):
0.200.1559 by Jelmer Vernooij
Fix compatibility with bzr 2.5.
31
        self.assertEquals("", refs.ref_to_branch_name("HEAD"))
32
        self.assertEquals("HEAD", refs.branch_name_to_ref(""))
0.200.872 by Jelmer Vernooij
Move refs code to separate module.
33
34
    def test_tag(self):
35
        self.assertRaises(ValueError, refs.ref_to_branch_name, "refs/tags/FOO")
36
37
    def test_branch(self):
38
        self.assertEquals("frost", refs.ref_to_branch_name("refs/heads/frost"))
39
        self.assertEquals("refs/heads/frost", refs.branch_name_to_ref("frost"))