Esempio n. 1
0
    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))
Esempio n. 2
0
    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)])
        p2 = ('add', 'foo.bar', [(0, 0)])

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

        # SUPER PATH
        p1 = ('remove', '', [('foo', [])])
        p2 = ('add', 'foo.bar', [(0, 0)])

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

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

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