예제 #1
0
 def testWithEmptyDicts(self):
   self.assertEqual(self.empty_dict, algo.JoinDisjointDicts(self.empty_dict,
     self.empty_dict))
   self.assertEqual(self.non_empty_dict, algo.JoinDisjointDicts(
     self.empty_dict, self.non_empty_dict))
   self.assertEqual(self.non_empty_dict, algo.JoinDisjointDicts(
     self.non_empty_dict, self.empty_dict))
예제 #2
0
  def testCommonCase(self):
    dict_a = {"TEST1": 1, "TEST2": 2}
    dict_b = {"TEST3": 3, "TEST4": 4}

    result = dict_a.copy()
    result.update(dict_b)

    self.assertEqual(result, algo.JoinDisjointDicts(dict_a, dict_b))
    self.assertEqual(result, algo.JoinDisjointDicts(dict_b, dict_a))