Пример #1
0
def test_dig_complex():
    # type: () -> None
    "Should "
    ob = E(foo=1, bar=2, fx=(1, 2, 3))
    assert dig.dig(ob, 'f*.1.0') == 1
Пример #2
0
def test_dig_object():
    # type: () -> None
    "Should "
    assert dig.dig(E(foo='bar', bar=E(jox='jox')), 'bar.jox') == 'jox'
Пример #3
0
def test_dig_dict_nested():
    # type: () -> None
    "Should "
    assert dig.dig({'foo': {'bar': 'baz'}}, 'foo.bar') == 'baz'
Пример #4
0
def test_dig_dict_iter():
    # type: () -> None
    "Should "
    assert dig.dig({'foo': (1, 2)}, 'foo.0') == 1
Пример #5
0
def test_dig_iter():
    # type: () -> None
    "Should "
    assert dig.dig((1, 2, 3, (41, 42, 43)), "3.0") == 41
Пример #6
0
def test_change_node_value(nodes, index, dpath, change) -> None:
    "Should change_node_value"
    node = nodes[index]
    node.value = change
    assert node.value == change
    assert dig(node, dpath) == change