/breezy/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/trunk

« back to all changes in this revision

Viewing changes to breezy/tests/test_weave.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    BytesIO,
32
32
    )
33
33
from . import TestCase, TestCaseInTempDir
34
 
from ..bzr.weave import Weave, WeaveFormatError
 
34
from ..bzr.weave import Weave, WeaveFormatError, WeaveInvalidChecksum
35
35
from ..bzr.weavefile import write_weave, read_weave
36
36
 
37
37
 
698
698
        w = read_weave(tmpf)
699
699
 
700
700
        self.assertEqual('hello\n', w.get_text('v1'))
701
 
        self.assertRaises(errors.WeaveInvalidChecksum, w.get_text, 'v2')
702
 
        self.assertRaises(errors.WeaveInvalidChecksum, w.get_lines, 'v2')
703
 
        self.assertRaises(errors.WeaveInvalidChecksum, w.check)
 
701
        self.assertRaises(WeaveInvalidChecksum, w.get_text, 'v2')
 
702
        self.assertRaises(WeaveInvalidChecksum, w.get_lines, 'v2')
 
703
        self.assertRaises(WeaveInvalidChecksum, w.check)
704
704
 
705
705
        # Change the sha checksum
706
706
        tmpf = BytesIO(b'# bzr weave file v5\n'
711
711
        w = read_weave(tmpf)
712
712
 
713
713
        self.assertEqual('hello\n', w.get_text('v1'))
714
 
        self.assertRaises(errors.WeaveInvalidChecksum, w.get_text, 'v2')
715
 
        self.assertRaises(errors.WeaveInvalidChecksum, w.get_lines, 'v2')
716
 
        self.assertRaises(errors.WeaveInvalidChecksum, w.check)
 
714
        self.assertRaises(WeaveInvalidChecksum, w.get_text, 'v2')
 
715
        self.assertRaises(WeaveInvalidChecksum, w.get_lines, 'v2')
 
716
        self.assertRaises(WeaveInvalidChecksum, w.check)
717
717
 
718
718
 
719
719
class TestWeave(TestCase):
766
766
    def test_empty_file(self):
767
767
        f = open('empty.weave', 'wb+')
768
768
        try:
769
 
            self.assertRaises(errors.WeaveFormatError,
770
 
                              read_weave, f)
 
769
            self.assertRaises(WeaveFormatError, read_weave, f)
771
770
        finally:
772
771
            f.close()