def testGetLineDiffsDifferent(self):
     """test getLineDiffs() method with different value"""
     a = A()
     b = B()
     diff = ListDiff(a, b, 'attribute')
     expected = [('equal', 0, 3, 0, 3), ('insert', 3, 3, 3, 4)]
     self.assertEqual(diff.getLineDiffs(), expected)
示例#2
0
 def testGetLineDiffsDifferent(self):
     """test getLineDiffs() method with different value"""
     a = A()
     b = B()
     diff = ListDiff(a, b, 'attribute')
     expected = [('equal', 0, 3, 0, 3), ('insert', 3, 3, 3, 4)]
     self.assertEqual(diff.getLineDiffs(), expected)
 def testGetLineDictDiffsDifferent(self):
     """test getLineDiffs() method with dict different value"""
     c = C()
     d = D()
     diff = ListDiff(c, d, 'attribute')
     expected = [('replace', 0, 1, 0, 1)]
     self.assertEqual(diff.getLineDiffs(), expected)
示例#4
0
 def testGetLineDictDiffsDifferent(self):
     """test getLineDiffs() method with dict different value"""
     c = C()
     d = D()
     diff = ListDiff(c, d, 'attribute')
     expected = [('replace', 0, 1, 0, 1)]
     self.assertEqual(diff.getLineDiffs(), expected)
    def testInvalidValue(self):
        """ Test if no error with invalid values """
        a = A()
        a.attribute = []
        b = A()

        b.attribute = None
        diff = ListDiff(a, b, 'attribute')
        self.assertEqual([('insert', 0, 0, 0, 1)], diff.getLineDiffs())

        b.attribute = 0
        diff = ListDiff(a, b, 'attribute')
        self.assertEqual([('insert', 0, 0, 0, 1)], diff.getLineDiffs())

        b.attribute = ''
        diff = ListDiff(a, b, 'attribute')
        self.assertEqual([('insert', 0, 0, 0, 1)], diff.getLineDiffs())
示例#6
0
    def testInvalidValue(self):
        """ Test if no error with invalid values """
        a = A()
        a.attribute = []
        b = A()

        b.attribute = None
        diff = ListDiff(a, b, 'attribute')
        self.assertEqual([('insert', 0, 0, 0, 1)], diff.getLineDiffs())

        b.attribute = 0
        diff = ListDiff(a, b, 'attribute')
        self.assertEqual([('insert', 0, 0, 0, 1)], diff.getLineDiffs())

        b.attribute = ''
        diff = ListDiff(a, b, 'attribute')
        self.assertEqual([('insert', 0, 0, 0, 1)], diff.getLineDiffs())
 def testGetLineDiffsSame(self):
     """test getLineDiffs() method with same value"""
     a = A()
     diff = ListDiff(a, a, 'attribute')
     expected = [('equal', 0, 3, 0, 3)]
     self.assertEqual(diff.getLineDiffs(), expected)
 def testGetLineDictDiffsSame(self):
     """test getLineDiffs() method with dict same value"""
     c = C()
     diff = ListDiff(c, c, 'attribute')
     expected = [('equal', 0, 1, 0, 1)]
     self.assertEqual(diff.getLineDiffs(), expected)
示例#9
0
 def testGetLineDiffsSame(self):
     """test getLineDiffs() method with same value"""
     a = A()
     diff = ListDiff(a, a, 'attribute')
     expected = [('equal', 0, 3, 0, 3)]
     self.assertEqual(diff.getLineDiffs(), expected)
示例#10
0
 def testGetLineDictDiffsSame(self):
     """test getLineDiffs() method with dict same value"""
     c = C()
     diff = ListDiff(c, c, 'attribute')
     expected = [('equal', 0, 1, 0, 1)]
     self.assertEqual(diff.getLineDiffs(), expected)