~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/compiled/test_dirstate_helpers.py

  • Committer: John Arbash Meinel
  • Date: 2007-05-04 17:46:16 UTC
  • mto: This revision was merged to the branch mainline in revision 2643.
  • Revision ID: john@arbash-meinel.com-20070504174616-4kdi7zi32h7ev4f9
Apply all of the tests for DirState.bisect_dirblock to the compiled function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for the compiled dirstate helpers."""
18
18
 
19
 
 
20
19
from bzrlib import (
21
20
    tests,
22
21
    )
26
25
    have_dirstate_helpers = False
27
26
else:
28
27
    have_dirstate_helpers = True
 
28
from bzrlib.tests import test_dirstate
29
29
 
30
30
 
31
31
class _CompiledDirstateHelpersFeature(tests.Feature):
134
134
        self.assertStrCmp(-1, 'ab/cd/ef', 'ab/cd-ef')
135
135
        self.assertStrCmp(-1, 'ab/cd', 'ab/cd-')
136
136
        self.assertStrCmp(-1, 'ab/cd', 'ab-cd')
 
137
 
 
138
 
 
139
class TestCompiledBisectDirblock(test_dirstate.TestBisectDirblock):
 
140
    """Test that bisect_dirblock() returns the expected values.
 
141
 
 
142
    bisect_dirblock is intended to work like bisect.bisect_left() except it
 
143
    knows it is working on dirblocks and that dirblocks are sorted by ('path',
 
144
    'to', 'foo') chunks rather than by raw 'path/to/foo'.
 
145
 
 
146
    This runs all the normal tests that TestBisectDirblock did, but uses the
 
147
    compiled version.
 
148
    """
 
149
 
 
150
    _test_needs_features = [CompiledDirstateHelpersFeature]
 
151
 
 
152
    if have_dirstate_helpers:
 
153
        bisect_dirblock_func = dirstate_helpers.bisect_dirblock
 
154
    else:
 
155
        bisect_dirblock_func = None
 
156