class TestSimpleCompatibilityChecker(TestCase):
    def setUp(self):
        self._compat_checker = SimpleCompatibilityChecker()

    def test_elimination(self):
        a = FakeRuleOne()
        b = FakeRuleTwo()
        rules = [a, b]
        results = self._compat_checker.compatibility_check(rules)
        self.assertEqual(1, len(results))
        self.assertIs(b, results[0].rule())

    def test_order_preservation(self):
        a = FakeRuleOne()
        b = FakeRuleThree()

        rules = [a, b]
        results = self._compat_checker.compatibility_check(rules)
        self.assertIs(a, results[0].rule())
        self.assertIs(b, results[1].rule())

        rules = [b, a]
        results = self._compat_checker.compatibility_check(rules)
        self.assertIs(b, results[0].rule())
        self.assertIs(a, results[1].rule())
Ejemplo n.º 2
0
    def _create_merger(smrc, transformers_runner):
        compat_checker = SimpleCompatibilityChecker()
        merge_strategy = ClassicMergingStrategy()
        max_repetitions = settings.settings(
            ["miscellaneous", "max_ccr_repetitions"])

        return CCRMerger2(transformers_runner, compat_checker, merge_strategy,
                          max_repetitions, smrc)
 def setUp(self):
     self._compat_checker = SimpleCompatibilityChecker()