コード例 #1
0
    def test_nest_no_keys(self):
        temp = {}
        keys = []
        value = "2"
        dict.nest(temp, keys, value)

        assert len(temp) == 0
コード例 #2
0
    def test_nest_single_key(self):
        temp = {}
        key = "one"
        value = "two"
        dict.nest(temp, key.split("."), value)

        assert temp["one"] == value
コード例 #3
0
    def test_nest_two_keys(self):
        temp = {}
        key = "one.two"
        value = "2"
        dict.nest(temp, key.split("."), value)

        assert temp["one"]["two"] == value
コード例 #4
0
    def test_nest_happy(self):
        temp = {}
        key = "one.two.three"
        value = 3
        test = dict.nest(temp, key.split("."), value)

        assert temp["one"]["two"]["three"] == value
コード例 #5
0
    def test_nest_none_keys(self):

        dict.nest(None, None, None)
        #if we get any errors the test will fail
        assert True