Example #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"
    )
Example #2
0
def test_basic_conversion():
    d = {'a': 'b'}
    s = {'a': 'to_e'}
    eq_(
        covert_with_schema(d, s),
        {"to_e": "b"},
        "Basic convert"
    )
Example #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"
    )
Example #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"
    )