Example #1
0
 def test_multiple_diffs(self):
     l1 = [1, 2, 3, 4, 5]
     l2 = [1, 22, 3, 44, 5]
     expected = (
         ([1], compare.Diff(l1[1], l2[1])),
         ([3], compare.Diff(l1[3], l2[3])),
     )
     self.assertEqual(expected, tuple(compare(l1, l2)))
Example #2
0
 def test_multiple_diffs(self):
     d1 = {"a": 1, "b": 2, "c": 3, "d": 4}
     d2 = {"a": 1, "b": 22, "c": 3, "d": 44, "e": 5}
     expected = (
         (["b"], compare.Diff(d1["b"], d2["b"])),
         (["d"], compare.Diff(d1["d"], d2["d"])),
         (["e"], compare.Diff(compare.missingKey, d2["e"])),
     )
     actual = tuple(compare(d1, d2))
     self.assertEqual(expected, actual)
Example #3
0
 def test_case_diff(self):
     """case insensitive keys, use value of "most-lowercase" key"""
     d1 = dict(AA=1, Aa=2, aA=3, aa=22, bB=6, BB=7)
     d2 = dict(Aa=4, BB=6)
     expected = (["aa"], compare.Diff(d1["aa"], d2["Aa"]))
     self.assertEqual(expected, tuple(compare(d1, d2))[0])
Example #4
0
 def test_size(self):
     d1 = {"a": 1, "b": 2}
     d2 = {"a": 1, "b": 2, "c": 3}
     expected = ((["c"], compare.Diff(compare.missingKey, d2["c"])), )
     actual = tuple(compare(d1, d2))
     self.assertEqual(expected, actual)
Example #5
0
 def test_value(self):
     d1 = {"a": 1, "b": 2}
     d2 = {"a": 1, "b": 22}
     expected = ((["b"], compare.Diff(d1["b"], d2["b"])), )
     actual = tuple(compare(d1, d2))
     self.assertEqual(expected, actual)
Example #6
0
 def test_none(self):
     d1 = {"a": 1, "b": 2}
     d2 = None
     expected = ([], compare.Diff(d1, d2))
     self.assertEqual(expected, tuple(compare(d1, d2))[0])
Example #7
0
 def test_diff(self):
     s1 = "foo"
     s2 = "bar"
     expected = ([], compare.Diff(s1, s2))
     self.assertEqual(expected, tuple(compare(s1, s2))[0])
Example #8
0
 def test_size(self):
     l1 = [1, 2, 3]
     l2 = [1, 2]
     expected = ([], compare.Diff(l1, l2))
     actual = tuple(compare(l1, l2))[0]
     self.assertEqual(expected, actual)
Example #9
0
 def test_value(self):
     l1 = [1, 2, 3]
     l2 = [1, 22, 3]
     expected = (([1], compare.Diff(l1[1], l2[1])), )
     self.assertEqual(expected, tuple(compare(l1, l2)))
Example #10
0
 def test_none(self):
     l1 = [1, 2, 3]
     l2 = None
     expected = ([], compare.Diff(l1, l2))
     self.assertEqual(expected, tuple(compare(l1, l2))[0])