Ejemplo n.º 1
0
 def test_set_dict_path_empty(self):
     d = {}
     k8s._set_dict_path(d, ["one", "two"], "val")
     self.assertEquals(d["one"]["two"], "val")
Ejemplo n.º 2
0
 def test_set_get_dict_path(self):
     d = {}
     k8s._set_dict_path(d, [1, 2, 3], 4)
     self.assertEqual(d, {1: {2: {3: 4}}})
     self.assertEqual(k8s._get_dict_path(d, (1, 2, 3)), 4)
Ejemplo n.º 3
0
 def test_set_get_dict_path_simple(self):
     d = {}
     k8s._set_dict_path(d, 'key', 'val')
     self.assertEqual(k8s._get_dict_path(d, 'key'), 'val')
Ejemplo n.º 4
0
 def test_set_dict_path_notempty(self):
     d = {"one": {"foo": "bar"}}
     k8s._set_dict_path(d, ["one", "two"], "val")
     self.assertEquals(d["one"]["foo"], "bar")
     self.assertEquals(d["one"]["two"], "val")
Ejemplo n.º 5
0
 def test_set_dict_path_overwrites(self):
     d = {"one": {"two": "OLD"}}
     k8s._set_dict_path(d, ["one", "two"], "val")
     self.assertEquals(d["one"]["two"], "val")
 def test_set_dict_path_empty(self):
     d = {}
     k8s._set_dict_path(d, ["one", "two"], "val")
     self.assertEquals(d["one"]["two"], "val")
 def test_set_get_dict_path_simple(self):
     d = {}
     k8s._set_dict_path(d, 'key', 'val')
     self.assertEqual(k8s._get_dict_path(d, 'key'), 'val')
 def test_set_get_dict_path(self):
     d = {}
     k8s._set_dict_path(d, [1,2,3], 4)
     self.assertEqual(d, {1:{2:{3:4}}})
     self.assertEqual(k8s._get_dict_path(d, (1,2,3)), 4)
 def test_set_dict_path_overwrites(self):
     d = {"one": {"two": "OLD"}}
     k8s._set_dict_path(d, ["one", "two"], "val")
     self.assertEquals(d["one"]["two"], "val")
 def test_set_dict_path_notempty(self):
     d = {"one": {"foo": "bar"}}
     k8s._set_dict_path(d, ["one", "two"], "val")
     self.assertEquals(d["one"]["foo"], "bar")
     self.assertEquals(d["one"]["two"], "val")