How to use the dictdiffer.conflict.ConflictFinder function in dictdiffer

To help you get started, we’ve selected a few dictdiffer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inveniosoftware / dictdiffer / tests / test_conflict.py View on Github external
def test_find_conflicts(self):
        p11 = ('add', 'foo.bar', [(0, 0)])
        p12 = ('add', 'foo', [(0, 0)])

        p21 = ('add', 'foo.bar', [(0, 0)])
        p22 = ('add', 'foo', [(1, 0)])

        conflicts = [Conflict(p11, p21)]

        c = ConflictFinder()
        self.assertEqual(repr(c.find_conflicts([p11, p12], [p21, p22])),
                         repr(conflicts))
github inveniosoftware / dictdiffer / tests / test_conflict.py View on Github external
def test_is_conflict(self):
        # SAME LENGTH NO CONFLICT
        p1 = ('add', 'foo', [(0, 0)])
        p2 = ('add', 'foo', [(2, 0)])

        c = ConflictFinder()
        self.assertFalse(c._is_conflict(p1, p2))

        p1 = ('add', 'foo.bar', [(0, 0)])
        p2 = ('add', 'foo.bar', [(2, 0)])

        c = ConflictFinder()
        self.assertFalse(c._is_conflict(p1, p2))

        # SAME LENGTH CONFLICT
        p1 = ('add', 'foo', [(0, 0)])
        p2 = ('add', 'foo', [(0, 0)])

        c = ConflictFinder()
        self.assertTrue(c._is_conflict(p1, p2))

        p1 = ('add', 'foo.bar', [(0, 0)])
github inveniosoftware / dictdiffer / dictdiffer / merge.py View on Github external
:param first: first data structure
        :param second: second data structure
        :param path_limits: list of paths, utilized to instantiate a
                            dictdiffer.utils.PathLimit object
        :param additional_info: Any object containing additional information
                                used by the resolution functions
        """
        self.lca = lca
        self.first = first
        self.second = second
        self.path_limit = PathLimit(path_limits)

        self.actions = actions
        self.additional_info = additional_info

        self.conflict_finder = ConflictFinder()

        self.resolver = Resolver(self.actions,
                                 self.additional_info)

        self.unifier = Unifier()

        self.conflicts = []
        self.unresolved_conflicts = []