Exemplo n.º 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"
             }
         }
     })
Exemplo n.º 2
0
 def test_add_keys_single_with_value(self):
     new_dict = utils.add_keys({}, ["foo"], "bar")
     self.assertEqual(new_dict, {"foo": "bar"})
Exemplo n.º 3
0
 def test_add_keys_single(self):
     new_dict = utils.add_keys({}, ["foo"])
     self.assertEqual(new_dict, {"foo": None})
Exemplo n.º 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"}}})
Exemplo n.º 5
0
 def test_add_keys_nested(self):
     new_dict = utils.add_keys({}, ["foo", "bar", "baz"])
     self.assertEqual(new_dict, {"foo": {"bar": {"baz": None}}})