~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Robert Collins
  • Date: 2009-12-22 23:09:50 UTC
  • mfrom: (4918 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4920.
  • Revision ID: robertc@robertcollins.net-20091222230950-39gjmost0lmu9ufg
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
AttribFeature = _AttribFeature()
64
64
 
65
65
 
66
 
class _CompiledPatienceDiffFeature(Feature):
67
 
 
68
 
    def _probe(self):
69
 
        try:
70
 
            import bzrlib._patiencediff_c
71
 
        except ImportError:
72
 
            return False
73
 
        return True
74
 
 
75
 
    def feature_name(self):
76
 
        return 'bzrlib._patiencediff_c'
77
 
 
78
 
CompiledPatienceDiffFeature = _CompiledPatienceDiffFeature()
 
66
compiled_patiencediff_feature = tests.ModuleAvailableFeature(
 
67
                                    'bzrlib._patiencediff_c')
79
68
 
80
69
 
81
70
def udiff_lines(old, new, allow_binary=False):
1156
1145
 
1157
1146
class TestPatienceDiffLib_c(TestPatienceDiffLib):
1158
1147
 
1159
 
    _test_needs_features = [CompiledPatienceDiffFeature]
 
1148
    _test_needs_features = [compiled_patiencediff_feature]
1160
1149
 
1161
1150
    def setUp(self):
1162
1151
        super(TestPatienceDiffLib_c, self).setUp()
1252
1241
 
1253
1242
class TestPatienceDiffLibFiles_c(TestPatienceDiffLibFiles):
1254
1243
 
1255
 
    _test_needs_features = [CompiledPatienceDiffFeature]
 
1244
    _test_needs_features = [compiled_patiencediff_feature]
1256
1245
 
1257
1246
    def setUp(self):
1258
1247
        super(TestPatienceDiffLibFiles_c, self).setUp()
1264
1253
class TestUsingCompiledIfAvailable(TestCase):
1265
1254
 
1266
1255
    def test_PatienceSequenceMatcher(self):
1267
 
        if CompiledPatienceDiffFeature.available():
 
1256
        if compiled_patiencediff_feature.available():
1268
1257
            from bzrlib._patiencediff_c import PatienceSequenceMatcher_c
1269
1258
            self.assertIs(PatienceSequenceMatcher_c,
1270
1259
                          bzrlib.patiencediff.PatienceSequenceMatcher)
1274
1263
                          bzrlib.patiencediff.PatienceSequenceMatcher)
1275
1264
 
1276
1265
    def test_unique_lcs(self):
1277
 
        if CompiledPatienceDiffFeature.available():
 
1266
        if compiled_patiencediff_feature.available():
1278
1267
            from bzrlib._patiencediff_c import unique_lcs_c
1279
1268
            self.assertIs(unique_lcs_c,
1280
1269
                          bzrlib.patiencediff.unique_lcs)
1284
1273
                          bzrlib.patiencediff.unique_lcs)
1285
1274
 
1286
1275
    def test_recurse_matches(self):
1287
 
        if CompiledPatienceDiffFeature.available():
 
1276
        if compiled_patiencediff_feature.available():
1288
1277
            from bzrlib._patiencediff_c import recurse_matches_c
1289
1278
            self.assertIs(recurse_matches_c,
1290
1279
                          bzrlib.patiencediff.recurse_matches)