Esempio n. 1
0
 def test_remap_key(self) -> None:
     remapped_dict = dict_utils.remap_dict({"key": "value"},
                                           {"key": "new-key"})
     assert remapped_dict == {"new-key": "value"}
Esempio n. 2
0
 def test_nested_key_in_mapping_is_not_subdict(self) -> None:
     with pytest.raises(ValueError,
                        match="Expected key 'not-dict' to contain dict"):
         dict_utils.remap_dict({"not-dict": "value"},
                               {"not-dict.key": "key"})
Esempio n. 3
0
 def test_nested_dict_mapping_removes_from_nested_dict(self) -> None:
     remapped_dict = dict_utils.remap_dict({"nested": {
         "key": "value"
     }}, {"nested.key": "key"})
     assert remapped_dict == {"key": "value", "nested": {}}
Esempio n. 4
0
 def test_nested_dict_mapping_creates_nested_dict(self) -> None:
     remapped_dict = dict_utils.remap_dict({"key": "value"},
                                           {"key": "nested.key"})
     assert remapped_dict == {"nested": {"key": "value"}}
Esempio n. 5
0
 def test_unknown_mappings_have_no_effect(self) -> None:
     remapped_dict = dict_utils.remap_dict({"key": "value"}, {"a": "b"})
     assert remapped_dict == {"key": "value"}
Esempio n. 6
0
 def test_no_op(self) -> None:
     remapped_dict = dict_utils.remap_dict({"key": "value"}, {"key": "key"})
     assert remapped_dict == {"key": "value"}