コード例 #1
0
ファイル: tests.py プロジェクト: rebeccawilliams/foia
 def test_patch_dict(self):
     """Verify fields are added, nothing gets overwritten, and misc fields
     are merged"""
     old_dict = {"a": 1, "b": 2, "misc": {"z": 100}}
     new_dict = {"b": 4, "c": 3, "misc": {"z": 999, "y": 99}}
     result = layer.patch_dict(old_dict, new_dict)
     self.assertEqual(result, {
         "a": 1, "b": 2, "c": 3, "misc": {"z": 100, "y": 99}})
コード例 #2
0
 def test_patch_dict(self):
     """Verify fields are added, nothing gets overwritten, and misc fields
     are merged"""
     old_dict = {"a": 1, "b": 2, "misc": {"z": 100}}
     new_dict = {"b": 4, "c": 3, "misc": {"z": 999, "y": 99}}
     result = layer.patch_dict(old_dict, new_dict)
     self.assertEqual(result, {
         "a": 1,
         "b": 2,
         "c": 3,
         "misc": {
             "z": 100,
             "y": 99
         }
     })
コード例 #3
0
 def test_patch_dict_noop(self):
     """If there are no new field, None is returned"""
     old_dict = {"a": 1, "b": 2}
     new_dict = {"b": 100}
     self.assertEqual(None, layer.patch_dict(old_dict, old_dict))
     self.assertEqual(None, layer.patch_dict(old_dict, new_dict))
コード例 #4
0
ファイル: tests.py プロジェクト: rebeccawilliams/foia
 def test_patch_dict_noop(self):
     """If there are no new field, None is returned"""
     old_dict = {"a": 1, "b": 2}
     new_dict = {"b": 100}
     self.assertEqual(None, layer.patch_dict(old_dict, old_dict))
     self.assertEqual(None, layer.patch_dict(old_dict, new_dict))