~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_foreign_vcs/test_branch.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:56:05 UTC
  • mfrom: (6615.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201195605-o7rl92wf6uyum3fk
(vila) Open trunk again as 2.8b1 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Canonical Ltd
 
1
# Copyright (C) 2009, 2011, 2016 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
19
19
 
20
20
 
21
21
from bzrlib.errors import (
 
22
    IncompatibleFormat,
22
23
    UnstackableBranchFormat,
23
24
    )
24
25
from bzrlib.revision import (
25
26
    NULL_REVISION,
26
27
    )
27
28
from bzrlib.tests import (
28
 
    TestCase,
29
29
    TestCaseWithTransport,
30
30
    )
31
31
 
61
61
        branch = self.make_branch()
62
62
        branch.set_parent("foobar")
63
63
 
64
 
    def test_break_lock(self):
65
 
        """Test that break_lock() works, even if it is a no-op."""
66
 
        branch = self.make_branch()
67
 
        branch.break_lock()
68
 
 
69
64
    def test_set_push_location(self):
70
65
        """Test that setting the push location works."""
71
66
        branch = self.make_branch()
106
101
    def test_null_revid_revno(self):
107
102
        """null: should return revno 0."""
108
103
        branch = self.make_branch()
109
 
        self.assertEquals(0, branch.revision_id_to_revno(NULL_REVISION))
 
104
        self.assertEqual(0, branch.revision_id_to_revno(NULL_REVISION))
110
105
 
111
106
    def test_get_stacked_on_url(self):
112
107
        """Test that get_stacked_on_url() behaves as expected.
124
119
 
125
120
    def test_last_revision_empty_branch(self):
126
121
        branch = self.make_empty_branch()
127
 
        self.assertEquals(NULL_REVISION, branch.last_revision())
128
 
        self.assertEquals(0, branch.revno())
129
 
        self.assertEquals((0, NULL_REVISION), branch.last_revision_info())
130
 
 
131
 
 
132
 
class ForeignBranchFormatTests(TestCase):
 
122
        self.assertEqual(NULL_REVISION, branch.last_revision())
 
123
        self.assertEqual(0, branch.revno())
 
124
        self.assertEqual((0, NULL_REVISION), branch.last_revision_info())
 
125
 
 
126
 
 
127
class ForeignBranchFormatTests(TestCaseWithTransport):
133
128
    """Basic tests for foreign branch format objects."""
134
129
 
135
130
    branch_format = None # Set to a BranchFormat instance by adapter
140
135
        Remote branches may be initializable on their own, but none currently
141
136
        support living in .bzr/branch.
142
137
        """
143
 
        self.assertRaises(NotImplementedError, self.branch_format.initialize, None)
 
138
        bzrdir = self.make_bzrdir('dir')
 
139
        self.assertRaises(IncompatibleFormat, self.branch_format.initialize, bzrdir)
144
140
 
145
141
    def test_get_format_description_type(self):
146
142
        self.assertIsInstance(self.branch_format.get_format_description(), str)
147
143
 
148
144
    def test_network_name(self):
149
145
        self.assertIsInstance(self.branch_format.network_name(), str)
150
 
 
151