Example #1
0
 def test_add_keys_nested_with_value_and_dict(self):
     start_dict = {"asdf": {"1234": "rewq"}}
     new_dict = utils.add_keys(start_dict, ["foo", "bar", "baz"], "bat")
     self.assertEqual(new_dict, {
         "asdf": {
             "1234": "rewq"
         },
         "foo": {
             "bar": {
                 "baz": "bat"
             }
         }
     })
Example #2
0
 def test_add_keys_single_with_value(self):
     new_dict = utils.add_keys({}, ["foo"], "bar")
     self.assertEqual(new_dict, {"foo": "bar"})
Example #3
0
 def test_add_keys_single(self):
     new_dict = utils.add_keys({}, ["foo"])
     self.assertEqual(new_dict, {"foo": None})
Example #4
0
 def test_add_keys_nested_with_value(self):
     new_dict = utils.add_keys({}, ["foo", "bar", "baz"], "bat")
     self.assertEqual(new_dict, {"foo": {"bar": {"baz": "bat"}}})
Example #5
0
 def test_add_keys_nested(self):
     new_dict = utils.add_keys({}, ["foo", "bar", "baz"])
     self.assertEqual(new_dict, {"foo": {"bar": {"baz": None}}})