示例#1
0
    def test5(self):
        class A(object):
            def __init__(self, val):
                self.val = val

            def __eq__(self, other):
                return self.val == other.val

        a = A(1)
        b = A(2)

        self.assertIsInstance(find_changes(a, b), Diff)
示例#2
0
    def test6(self):
        class A(object):
            pass

        class B(object):
            pass

        a = A()
        b = B()

        diff = find_changes(a, b)
        self.assertIsInstance(diff, Diff)
        self.assertIsInstance(diff.changed, B)
示例#3
0
 def test4(self):
     a = [1]
     b = [2]
     self.assertIsInstance(find_changes(a, b), ListDiff)
示例#4
0
 def test3(self):
     a = {'a': 'a'}
     b = {'a': 'b'}
     self.assertIsInstance(find_changes(a, b), DictDiff)
示例#5
0
 def test2(self):
     a = 1
     b = 2
     self.assertIsInstance(find_changes(a, b), Diff)
示例#6
0
 def test1(self):
     a = b = 42
     self.assertIs(find_changes(a, b), None)
示例#7
0
    def test2(self):
        changes = pythonify(jsonify(find_changes(self.a, self.b)))

        self.assertEqual(tups2lists(reconstitute(self.a, changes)),
                         tups2lists(self.b))
示例#8
0
    def test1(self):
        changes = find_changes(self.a, self.b)

        self.assertEqual(tups2lists(reconstitute(self.a, changes)),
                         tups2lists(self.b))