Exemple #1
0
def test_split_overlap_complex():
    subject = {
        'dotted': {
            'key': 1
        },
        'dotted.something_else': {
            'again': 2
        },
        'dotted.something_else.entirely': 3,
        'key.thing': {
            'key': 4
        },
        'key': {
            'thing.another_key': 5
        },
    }

    separated = _split_keys(subject)

    assert separated == {
        'dotted': {
            'key': 1,
            'something_else': {
                'again': 2,
                'entirely': 3
            }
        },
        'key': {
            'thing': {
                'key': 4,
                'another_key': 5
            }
        }
    }
Exemple #2
0
def test_split_multiple():
    subject = {'dotted.key': 123, 'another.dotted.key': 456}

    separated = _split_keys(subject)

    assert len(separated) == 2
    assert separated['dotted']['key'] == 123
    assert separated['another']['dotted']['key'] == 456
Exemple #3
0
def test_split_overlap_simple():
    subject = {'dotted.key': 123, 'dotted.something_else': 456}

    separated = _split_keys(subject)

    assert len(separated) == 1
    assert len(separated['dotted']) == 2
    assert separated['dotted']['something_else'] == 456
Exemple #4
0
def test_split_trivial():
    subject = {'dotted.key': 42}

    separated = _split_keys(subject)

    assert separated['dotted']['key'] == 42
Exemple #5
0
def test_split_none():
    subject = {'key': 'value', 'another_key': 123}

    separated = _split_keys(subject)

    assert subject == separated