~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_knit.py

  • Committer: Alexander Belchenko
  • Date: 2010-06-17 08:53:15 UTC
  • mfrom: (5300 +trunk)
  • mto: (5303.2.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5305.
  • Revision ID: bialix@ukr.net-20100617085315-hr8186zck57zn35s
merge bzr.dev; fix NEWS

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()