Exemplo n.º 1
0
def test_add_to_non_list():

    dictionary = {'key': 'value1'}

    patcher = Patcher(dictionary)

    with pytest.raises(exceptions.InvalidKeyTypeException):
        patcher.add(key='key', value='value2')
Exemplo n.º 2
0
def test_add_to_non_list():

    dictionary = {'key': 'value1'}

    patcher = Patcher(dictionary)

    with pytest.raises(exceptions.InvalidKeyTypeException):
        patcher.add(key='key', value='value2')
Exemplo n.º 3
0
def test_add():

    dictionary = {'key': ['value1']}

    expected_dictionary = {'key': ['value1', 'value2']}

    patcher = Patcher(dictionary)
    patcher.add(key='key', value='value2')

    assert expected_dictionary == dictionary
Exemplo n.º 4
0
def test_add_to_complex_key():

    dictionary = {'key1': {'key2': ['value1']}}

    expected_dictionary = {'key1': {'key2': ['value1', 'value2']}}

    patcher = Patcher(dictionary)
    patcher.add(key='key1:key2', value='value2')

    assert expected_dictionary == dictionary
Exemplo n.º 5
0
def test_add():

    dictionary = {'key': ['value1']}

    expected_dictionary = {'key': ['value1', 'value2']}

    patcher = Patcher(dictionary)
    patcher.add(key='key', value='value2')

    assert expected_dictionary == dictionary
Exemplo n.º 6
0
def test_add_to_complex_key():

    dictionary = {
        'key1': {
            'key2': ['value1']
        }
    }

    expected_dictionary = {
        'key1': {
            'key2': ['value1', 'value2']
        }
    }

    patcher = Patcher(dictionary)
    patcher.add(key='key1:key2', value='value2')

    assert expected_dictionary == dictionary