~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__dirstate_helpers.py

  • Committer: Vincent Ladeuil
  • Date: 2009-06-22 14:32:48 UTC
  • mto: (4471.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4472.
  • Revision ID: v.ladeuil+lp@free.fr-20090622143248-pe4av866hxgzn60e
Use the same method or function names for _dirstate_helpers in pyrex and
python modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
249
249
    """Run all Bisect Path tests against _bisect_path_left_py."""
250
250
 
251
251
    def get_bisect_path(self):
252
 
        from bzrlib._dirstate_helpers_py import _bisect_path_left_py
253
 
        return _bisect_path_left_py
 
252
        from bzrlib._dirstate_helpers_py import _bisect_path_left
 
253
        return _bisect_path_left
254
254
 
255
255
    def get_bisect(self):
256
256
        return bisect.bisect_left, 0
262
262
    _test_needs_features = [CompiledDirstateHelpersFeature]
263
263
 
264
264
    def get_bisect_path(self):
265
 
        from bzrlib._dirstate_helpers_pyx import _bisect_path_left_c
266
 
        return _bisect_path_left_c
 
265
        from bzrlib._dirstate_helpers_pyx import _bisect_path_left
 
266
        return _bisect_path_left
267
267
 
268
268
 
269
269
class TestBisectPathRight(tests.TestCase, TestBisectPathMixin):
270
270
    """Run all Bisect Path tests against _bisect_path_right_py"""
271
271
 
272
272
    def get_bisect_path(self):
273
 
        from bzrlib._dirstate_helpers_py import _bisect_path_right_py
274
 
        return _bisect_path_right_py
 
273
        from bzrlib._dirstate_helpers_py import _bisect_path_right
 
274
        return _bisect_path_right
275
275
 
276
276
    def get_bisect(self):
277
277
        return bisect.bisect_right, -1
283
283
    _test_needs_features = [CompiledDirstateHelpersFeature]
284
284
 
285
285
    def get_bisect_path(self):
286
 
        from bzrlib._dirstate_helpers_pyx import _bisect_path_right_c
287
 
        return _bisect_path_right_c
 
286
        from bzrlib._dirstate_helpers_pyx import _bisect_path_right
 
287
        return _bisect_path_right
288
288
 
289
289
 
290
290
class TestBisectDirblock(tests.TestCase):
301
301
 
302
302
    def get_bisect_dirblock(self):
303
303
        """Return an implementation of bisect_dirblock"""
304
 
        from bzrlib._dirstate_helpers_py import bisect_dirblock_py
305
 
        return bisect_dirblock_py
 
304
        from bzrlib._dirstate_helpers_py import bisect_dirblock
 
305
        return bisect_dirblock
306
306
 
307
307
    def assertBisect(self, dirblocks, split_dirblocks, path, *args, **kwargs):
308
308
        """Assert that bisect_split works like bisect_left on the split paths.
395
395
    _test_needs_features = [CompiledDirstateHelpersFeature]
396
396
 
397
397
    def get_bisect_dirblock(self):
398
 
        from bzrlib._dirstate_helpers_pyx import bisect_dirblock_c
399
 
        return bisect_dirblock_c
 
398
        from bzrlib._dirstate_helpers_pyx import bisect_dirblock
 
399
        return bisect_dirblock
400
400
 
401
401
 
402
402
class TestCmpByDirs(tests.TestCase):
411
411
 
412
412
    def get_cmp_by_dirs(self):
413
413
        """Get a specific implementation of cmp_by_dirs."""
414
 
        from bzrlib._dirstate_helpers_py import cmp_by_dirs_py
415
 
        return cmp_by_dirs_py
 
414
        from bzrlib._dirstate_helpers_py import cmp_by_dirs
 
415
        return cmp_by_dirs
416
416
 
417
417
    def assertCmpByDirs(self, expected, str1, str2):
418
418
        """Compare the two strings, in both directions.
517
517
    _test_needs_features = [CompiledDirstateHelpersFeature]
518
518
 
519
519
    def get_cmp_by_dirs(self):
520
 
        from bzrlib._dirstate_helpers_pyx import cmp_by_dirs_c
521
 
        return cmp_by_dirs_c
 
520
        from bzrlib._dirstate_helpers_pyx import cmp_by_dirs
 
521
        return cmp_by_dirs
522
522
 
523
523
 
524
524
class TestCmpPathByDirblock(tests.TestCase):
533
533
 
534
534
    def get_cmp_path_by_dirblock(self):
535
535
        """Get a specific implementation of _cmp_path_by_dirblock."""
536
 
        from bzrlib._dirstate_helpers_py import _cmp_path_by_dirblock_py
537
 
        return _cmp_path_by_dirblock_py
 
536
        from bzrlib._dirstate_helpers_py import _cmp_path_by_dirblock
 
537
        return _cmp_path_by_dirblock
538
538
 
539
539
    def assertCmpPathByDirblock(self, paths):
540
540
        """Compare all paths and make sure they evaluate to the correct order.
668
668
    _test_needs_features = [CompiledDirstateHelpersFeature]
669
669
 
670
670
    def get_cmp_by_dirs(self):
671
 
        from bzrlib._dirstate_helpers_pyx import _cmp_path_by_dirblock_c
672
 
        return _cmp_path_by_dirblock_c
 
671
        from bzrlib._dirstate_helpers_pyx import _cmp_path_by_dirblock
 
672
        return _cmp_path_by_dirblock
673
673
 
674
674
 
675
675
class TestMemRChr(tests.TestCase):
726
726
    """
727
727
 
728
728
    def get_read_dirblocks(self):
729
 
        from bzrlib._dirstate_helpers_py import _read_dirblocks_py
730
 
        return _read_dirblocks_py
 
729
        from bzrlib._dirstate_helpers_py import _read_dirblocks
 
730
        return _read_dirblocks
731
731
 
732
732
    def test_smoketest(self):
733
733
        """Make sure that we can create and read back a simple file."""
762
762
    _test_needs_features = [CompiledDirstateHelpersFeature]
763
763
 
764
764
    def get_read_dirblocks(self):
765
 
        from bzrlib._dirstate_helpers_pyx import _read_dirblocks_c
766
 
        return _read_dirblocks_c
 
765
        from bzrlib._dirstate_helpers_pyx import _read_dirblocks
 
766
        return _read_dirblocks
767
767
 
768
768
 
769
769
class TestUsingCompiledIfAvailable(tests.TestCase):
776
776
 
777
777
    def test_bisect_dirblock(self):
778
778
        if CompiledDirstateHelpersFeature.available():
779
 
            from bzrlib._dirstate_helpers_pyx import bisect_dirblock_c
780
 
            self.assertIs(bisect_dirblock_c, dirstate.bisect_dirblock)
 
779
            from bzrlib._dirstate_helpers_pyx import bisect_dirblock
781
780
        else:
782
 
            from bzrlib._dirstate_helpers_py import bisect_dirblock_py
783
 
            self.assertIs(bisect_dirblock_py, dirstate.bisect_dirblock)
 
781
            from bzrlib._dirstate_helpers_py import bisect_dirblock
 
782
        self.assertIs(bisect_dirblock, dirstate.bisect_dirblock)
784
783
 
785
784
    def test__bisect_path_left(self):
786
785
        if CompiledDirstateHelpersFeature.available():
787
 
            from bzrlib._dirstate_helpers_pyx import _bisect_path_left_c
788
 
            self.assertIs(_bisect_path_left_c, dirstate._bisect_path_left)
 
786
            from bzrlib._dirstate_helpers_pyx import _bisect_path_left
789
787
        else:
790
 
            from bzrlib._dirstate_helpers_py import _bisect_path_left_py
791
 
            self.assertIs(_bisect_path_left_py, dirstate._bisect_path_left)
 
788
            from bzrlib._dirstate_helpers_py import _bisect_path_left
 
789
        self.assertIs(_bisect_path_left, dirstate._bisect_path_left)
792
790
 
793
791
    def test__bisect_path_right(self):
794
792
        if CompiledDirstateHelpersFeature.available():
795
 
            from bzrlib._dirstate_helpers_pyx import _bisect_path_right_c
796
 
            self.assertIs(_bisect_path_right_c, dirstate._bisect_path_right)
 
793
            from bzrlib._dirstate_helpers_pyx import _bisect_path_right
797
794
        else:
798
 
            from bzrlib._dirstate_helpers_py import _bisect_path_right_py
799
 
            self.assertIs(_bisect_path_right_py, dirstate._bisect_path_right)
 
795
            from bzrlib._dirstate_helpers_py import _bisect_path_right
 
796
        self.assertIs(_bisect_path_right, dirstate._bisect_path_right)
800
797
 
801
798
    def test_cmp_by_dirs(self):
802
799
        if CompiledDirstateHelpersFeature.available():
803
 
            from bzrlib._dirstate_helpers_pyx import cmp_by_dirs_c
804
 
            self.assertIs(cmp_by_dirs_c, dirstate.cmp_by_dirs)
 
800
            from bzrlib._dirstate_helpers_pyx import cmp_by_dirs
805
801
        else:
806
 
            from bzrlib._dirstate_helpers_py import cmp_by_dirs_py
807
 
            self.assertIs(cmp_by_dirs_py, dirstate.cmp_by_dirs)
 
802
            from bzrlib._dirstate_helpers_py import cmp_by_dirs
 
803
        self.assertIs(cmp_by_dirs, dirstate.cmp_by_dirs)
808
804
 
809
805
    def test__read_dirblocks(self):
810
806
        if CompiledDirstateHelpersFeature.available():
811
 
            from bzrlib._dirstate_helpers_pyx import _read_dirblocks_c
812
 
            self.assertIs(_read_dirblocks_c, dirstate._read_dirblocks)
 
807
            from bzrlib._dirstate_helpers_pyx import _read_dirblocks
813
808
        else:
814
 
            from bzrlib._dirstate_helpers_py import _read_dirblocks_py
815
 
            self.assertIs(_read_dirblocks_py, dirstate._read_dirblocks)
 
809
            from bzrlib._dirstate_helpers_py import _read_dirblocks
 
810
        self.assertIs(_read_dirblocks, dirstate._read_dirblocks)
816
811
 
817
812
    def test_update_entry(self):
818
813
        if CompiledDirstateHelpersFeature.available():
819
814
            from bzrlib._dirstate_helpers_pyx import update_entry
820
 
            self.assertIs(update_entry, dirstate.update_entry)
821
815
        else:
822
 
            from bzrlib.dirstate import py_update_entry
823
 
            self.assertIs(py_update_entry, dirstate.py_update_entry)
 
816
            from bzrlib.dirstate import update_entry
 
817
        self.assertIs(update_entry, dirstate.update_entry)
824
818
 
825
819
    def test_process_entry(self):
826
820
        if CompiledDirstateHelpersFeature.available():