def test__compare_irmc_profile_list__same_type_list_value_different(self): myprofile1 = {"one": 1, "two": 2, "three": [{"four": 4, "seven": 7}, {"five": 5}, {"six": 6}]} myprofile2 = {"one": 1, "two": 2, "three": [{"four": 4, "seven": 7}, {"eight": 8}, {"six": 6}]} myclist = [] cval, clist = irmc_utils.compare_irmc_profile(myprofile1, myprofile2, "", myclist) self.assertEqual(False, cval) self.assertIn("missing keys 'eight', found keys 'five'", " ".join(str(x) for x in clist))
def test__compare_irmc_profile__same_type_list_length_different(self): myprofile1 = {"one": 1, "two": 2, "three": [{"four": 4, "seven": 7}, {"five": 5}, {"six": 6}]} myprofile2 = {"one": 1, "two": 2, "three": [{"four": 4, "seven": 7}, {"six": 6}]} myclist = [] cval, clist = irmc_utils.compare_irmc_profile(myprofile1, myprofile2, "", myclist) self.assertEqual(False, cval) self.assertIn("list len '3' != list len '2' ", " ".join(str(x) for x in clist))
def test__compare_irmc_profile__same_type_identical(self): myprofile1 = {"one": 1, "two": 2, "three": [{"four": 4, "seven": 7}, {"five": 5}, {"six": 6}]} myprofile2 = myprofile1 myclist = [] cval, clist = irmc_utils.compare_irmc_profile(myprofile1, myprofile2, "", myclist) self.assertEqual(True, cval) self.assertEqual(myclist, clist)
def test__compare_irmc_profile__list_type_different(self): myprofile1 = {"one": 1, "two": 2, "three": [{"four": 4, "seven": 7}, {"five": 5}, {"six": 6}]} myprofile2 = {"one": 1, "two": 2, "three": {"four": 4, "seven": 7}} myclist = [] cval, clist = irmc_utils.compare_irmc_profile(myprofile1, myprofile2, "", myclist) result = " ".join(str(x) for x in clist).replace("class", "type") self.assertEqual(False, cval) self.assertIn("type '<type 'list'>' != type '<type 'dict'>'", result)