~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_weave.py

  • Committer: Vincent Ladeuil
  • Date: 2010-03-10 09:33:04 UTC
  • mto: (5082.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5083.
  • Revision ID: v.ladeuil+lp@free.fr-20100310093304-4245t4tazd4sxoav
Cleanup test from overly cautious checks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011, 2016 Canonical Ltd
 
1
# Copyright (C) 2005 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
28
28
    )
29
29
from bzrlib.osutils import sha_string
30
30
from bzrlib.tests import TestCase, TestCaseInTempDir
31
 
from bzrlib.weave import Weave, WeaveFormatError
 
31
from bzrlib.weave import Weave, WeaveFormatError, WeaveError
32
32
from bzrlib.weavefile import write_weave, read_weave
33
33
 
34
34
 
64
64
 
65
65
class WeaveContains(TestBase):
66
66
    """Weave __contains__ operator"""
67
 
 
68
67
    def runTest(self):
69
68
        k = Weave(get_scope=lambda:None)
70
69
        self.assertFalse('foo' in k)
73
72
 
74
73
 
75
74
class Easy(TestBase):
76
 
 
77
75
    def runTest(self):
78
76
        k = Weave()
79
77
 
80
78
 
81
79
class AnnotateOne(TestBase):
82
 
 
83
80
    def runTest(self):
84
81
        k = Weave()
85
82
        k.add_lines('text0', [], TEXT_0)
89
86
 
90
87
class InvalidAdd(TestBase):
91
88
    """Try to use invalid version number during add."""
92
 
 
93
89
    def runTest(self):
94
90
        k = Weave()
95
91
 
111
107
 
112
108
 
113
109
class InvalidRepeatedAdd(TestBase):
114
 
 
115
110
    def runTest(self):
116
111
        k = Weave()
117
112
        k.add_lines('basis', [], TEXT_0)
538
533
 
539
534
class Merge(TestBase):
540
535
    """Storage of versions that merge diverged parents"""
541
 
 
542
536
    def runTest(self):
543
537
        k = Weave()
544
538
 
588
582
 
589
583
        merged = k.merge([1, 2])
590
584
 
591
 
        self.assertEqual([[['aaa']],
 
585
        self.assertEquals([[['aaa']],
592
586
                           [['111'], ['222']],
593
587
                           [['bbb']]])
594
588
 
655
649
 
656
650
 
657
651
class JoinWeavesTests(TestBase):
658
 
 
659
652
    def setUp(self):
660
653
        super(JoinWeavesTests, self).setUp()
661
654
        self.weave1 = Weave()
681
674
        write_weave(w, tmpf)
682
675
 
683
676
        # Because we are corrupting, we need to make sure we have the exact text
684
 
        self.assertEqual('# bzr weave file v5\n'
 
677
        self.assertEquals('# bzr weave file v5\n'
685
678
                          'i\n1 f572d396fae9206628714fb2ce00f72e94f2258f\nn v1\n\n'
686
679
                          'i 0\n1 90f265c6e75f1c8f9ab76dcf85528352c5f215ef\nn v2\n\n'
687
680
                          'w\n{ 0\n. hello\n}\n{ 1\n. there\n}\nW\n',