~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_knit.py

  • Committer: Andrew Bennetts
  • Date: 2010-06-04 03:09:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5280.
  • Revision ID: andrew.bennetts@canonical.com-20100604030935-4slnx0e8uh9b8yk6
lazy_import most things in merge.py; add a few representative modules to the import tariff tests; tweak a couple of other modules so that patiencediff is not necessarily imported; remove a bunch of unused imports from test_knit.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for Knit data structure"""
18
18
 
19
19
from cStringIO import StringIO
20
 
import difflib
21
 
import gzip
22
20
import sys
23
21
 
24
22
from bzrlib import (
25
23
    errors,
26
 
    generate_ids,
27
24
    knit,
28
25
    multiparent,
29
26
    osutils,
30
27
    pack,
31
28
    tests,
 
29
    tuned_gzip,
32
30
    )
33
31
from bzrlib.errors import (
34
 
    RevisionAlreadyPresent,
35
32
    KnitHeaderError,
36
 
    RevisionNotPresent,
37
33
    NoSuchFile,
38
34
    )
39
35
from bzrlib.index import *
40
36
from bzrlib.knit import (
41
37
    AnnotatedKnitContent,
42
38
    KnitContent,
43
 
    KnitSequenceMatcher,
44
39
    KnitVersionedFiles,
45
40
    PlainKnitContent,
46
41
    _VFContentMapGenerator,
50
45
    _KnitKeyAccess,
51
46
    make_file_factory,
52
47
    )
 
48
from bzrlib.patiencediff import PatienceSequenceMatcher
53
49
from bzrlib.repofmt import pack_repo
54
50
from bzrlib.tests import (
55
 
    Feature,
56
 
    KnownFailure,
57
51
    TestCase,
58
52
    TestCaseWithMemoryTransport,
59
53
    TestCaseWithTransport,
60
54
    TestNotApplicable,
61
55
    )
62
56
from bzrlib.transport import get_transport
63
 
from bzrlib.transport.memory import MemoryTransport
64
 
from bzrlib.tuned_gzip import GzipFile
65
57
from bzrlib.versionedfile import (
66
58
    AbsentContentFactory,
67
59
    ConstantMapper,
106
98
        line_delta = source_content.line_delta(target_content)
107
99
        delta_blocks = list(KnitContent.get_line_delta_blocks(line_delta,
108
100
            source_lines, target_lines))
109
 
        matcher = KnitSequenceMatcher(None, source_lines, target_lines)
110
 
        matcher_blocks = list(list(matcher.get_matching_blocks()))
 
101
        matcher = PatienceSequenceMatcher(None, source_lines, target_lines)
 
102
        matcher_blocks = list(matcher.get_matching_blocks())
111
103
        self.assertEqual(matcher_blocks, delta_blocks)
112
104
 
113
105
    def test_get_line_delta_blocks(self):
700
692
 
701
693
    def create_gz_content(self, text):
702
694
        sio = StringIO()
703
 
        gz_file = gzip.GzipFile(mode='wb', fileobj=sio)
 
695
        gz_file = tuned_gzip.GzipFile(mode='wb', fileobj=sio)
704
696
        gz_file.write(text)
705
697
        gz_file.close()
706
698
        return sio.getvalue()