~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-21 23:03:03 UTC
  • mto: This revision was merged to the branch mainline in revision 1979.
  • Revision ID: john@arbash-meinel.com-20060821230303-deea7a8c292cd33f
Cleanup and test last:

Show diffs side-by-side

added added

removed removed

Lines of Context:
323
323
        self.tree.branch.repository.fetch(self.tree2.branch.repository,
324
324
                                          revision_id='alt_r3')
325
325
        self.assertInHistoryIs(None, 'alt_r3', 'revid:alt_r3')
 
326
 
 
327
 
 
328
class TestRevisionSpec_last(TestRevisionSpec):
 
329
 
 
330
    def test_positive(self):
 
331
        self.assertInHistoryIs(2, 'r2', 'last:1')
 
332
        self.assertInHistoryIs(1, 'r1', 'last:2')
 
333
        self.assertInHistoryIs(0, None, 'last:3')
 
334
 
 
335
    def test_empty(self):
 
336
        self.assertInHistoryIs(2, 'r2', 'last:')
 
337
 
 
338
    def test_negative(self):
 
339
        self.assertInvalid('last:-1',
 
340
                           extra='; you must supply a positive value')
 
341
 
 
342
    def test_missing(self):
 
343
        self.assertInvalid('last:4')
 
344
 
 
345
    def test_no_history(self):
 
346
        tree = self.make_branch_and_tree('tree3')
 
347
 
 
348
        self.assertRaises(errors.NoCommits,
 
349
                          RevisionSpec('last:').in_history, tree.branch)
 
350
 
 
351
    def test_not_a_number(self):
 
352
        try:
 
353
            int('Y')
 
354
        except ValueError, e:
 
355
            pass
 
356
        self.assertInvalid('last:Y', extra='; ' + str(e))