b.t.t.TestBisectPathMixin(object) : class documentation

Part of bzrlib.tests.test__dirstate_helpers View In Hierarchy

Known subclasses: bzrlib.tests.test__dirstate_helpers.TestBisectPathLeft, bzrlib.tests.test__dirstate_helpers.TestBisectPathRight

Test that _bisect_path_*() returns the expected values.

_bisect_path_* is intended to work like bisect.bisect_*() except it knows it is working on paths that are sorted by ('path', 'to', 'foo') chunks rather than by raw 'path/to/foo'.

Test Cases should inherit from this and override get_bisect_path return their implementation, and get_bisect to return the matching bisect.bisect_* function.

Method get_bisect_path Return an implementation of _bisect_path_*
Method get_bisect Return a version of bisect.bisect_*.
Method assertBisect Assert that bisect_split works like bisect_left on the split paths.
Method split_for_dirblocks Undocumented
Method test_simple In the simple case it works just like bisect_left
Method test_involved This is where bisect_path_* diverges slightly.
def get_bisect_path(self):
Return an implementation of _bisect_path_*
def get_bisect(self):
Return a version of bisect.bisect_*.

Also, for the 'exists' check, return the offset to the real values. For example bisect_left returns the index of an entry, while bisect_right returns the index after an entry

Returns(bisect_func, offset)
def assertBisect(self, paths, split_paths, path, exists=True):
Assert that bisect_split works like bisect_left on the split paths.

All other arguments will be passed along.

ParameterspathsA list of path names
split_pathsA list of path names that are already split up by directory ('path/to/foo' => ('path', 'to', 'foo'))
pathThe path we are indexing.
existsThe path should be present, so make sure the final location actually points to the right value.
def split_for_dirblocks(self, paths):
Undocumented
def test_simple(self):
In the simple case it works just like bisect_left
def test_involved(self):
This is where bisect_path_* diverges slightly.
API Documentation for Bazaar, generated by pydoctor at 2019-10-23 00:34:42.