~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revisionnamespaces.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-24 00:28:18 UTC
  • mto: This revision was merged to the branch mainline in revision 1979.
  • Revision ID: john@arbash-meinel.com-20060824002818-01e99e564cd68550
Clean up __repr__, as well as add tests that we can handle -r12:branch/

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
 
81
81
    def test_unregistered_spec(self):
82
82
        self.assertRaises(errors.NoSuchRevisionSpec, get_revision_spec, 'foo')
83
 
 
84
 
 
85
 
class TestRevisionSpec_int(TestRevisionSpec):
86
 
    
87
 
    def test_positive(self):
 
83
        self.assertRaises(errors.NoSuchRevisionSpec, get_revision_spec, '123a')
 
84
 
 
85
 
 
86
class TestRevisionSpec_revno(TestRevisionSpec):
 
87
 
 
88
    def test_positive_int(self):
88
89
        self.assertInHistoryIs(0, None, '0')
89
90
        self.assertInHistoryIs(1, 'r1', '1')
90
91
        self.assertInHistoryIs(2, 'r2', '2')
91
92
 
92
93
        self.assertInvalid('3')
93
94
 
94
 
    def test_negative(self):
 
95
    def test_negative_int(self):
95
96
        self.assertInHistoryIs(2, 'r2', '-1')
96
97
        self.assertInHistoryIs(1, 'r1', '-2')
97
98
 
99
100
        self.assertInHistoryIs(1, 'r1', '-4')
100
101
        self.assertInHistoryIs(1, 'r1', '-100')
101
102
 
102
 
 
103
 
class TestRevisionSpec_revno(TestRevisionSpec):
104
 
 
105
103
    def test_positive(self):
106
104
        self.assertInHistoryIs(0, None, 'revno:0')
107
105
        self.assertInHistoryIs(1, 'r1', 'revno:1')
150
148
        self.assertEqual(2, revinfo.revno)
151
149
        self.assertEqual('alt_r2', revinfo.rev_id)
152
150
 
 
151
    def test_int_with_branch(self):
 
152
        revinfo = self.get_in_history('2:tree2')
 
153
        self.assertNotEqual(self.tree.branch.base, revinfo.branch.base)
 
154
        self.assertEqual(self.tree2.branch.base, revinfo.branch.base)
 
155
        self.assertEqual(2, revinfo.revno)
 
156
        self.assertEqual('alt_r2', revinfo.rev_id)
 
157
 
153
158
    def test_with_url(self):
154
159
        url = self.get_url() + '/tree2'
155
160
        revinfo = self.get_in_history('revno:2:%s' % (url,))