Пример #1
0
def test_conversion_flip_fields():
    d = {'a': 'b', 'c': 'd'}
    s = {'a': 'c', 'c': 'a'}
    eq_(
        covert_with_schema(d, s),
        {"c": "b", 'a': 'd'},
        "Flip two fields"
    )
Пример #2
0
def test_basic_conversion():
    d = {'a': 'b'}
    s = {'a': 'to_e'}
    eq_(
        covert_with_schema(d, s),
        {"to_e": "b"},
        "Basic convert"
    )
Пример #3
0
def test_hide_to_inner_dict():
    d = {'a': 'b', 'c': 'd'}
    s = {'a': 'c.a', 'c': 'c.c'}

    eq_(
        covert_with_schema(d, s),
        {'c': {'a': 'b', 'c': 'd'}},
        "Hide to inner dict"
    )
Пример #4
0
def test_catch_data_loose():
    d = {'a': 'b', 'c': 'd'}
    s = {'a': 'c.a', 'c.b': 'a'}


    eq_(
        covert_with_schema(d, s),
        {'c': {'a': 'b', 'c': 'd'}},
        "Hide to inner dict"
    )