Пример #1
0
def test_recursive() -> None:
    start = [
        {"foo": ["bar"]}
    ]
    expected = [
        {"foo": [example_function("bar")]}
    ]
    assert recursive_map(start, example_function) == expected
Пример #2
0
def test_unhandled() -> None:
    with pytest.raises(ValueError):
        recursive_map(object, example_function)
Пример #3
0
def test_dict() -> None:
    assert recursive_map({"asd": "qwe"}, example_function) == {"asd": example_function("qwe")}
Пример #4
0
def test_list() -> None:
    assert recursive_map(["foo"], example_function) == [example_function("foo")]
Пример #5
0
def test_none() -> None:
    assert recursive_map(None, example_function) == example_function(None)
Пример #6
0
def test_str() -> None:
    assert recursive_map("test", example_function) == example_function("test")
Пример #7
0
def test_float() -> None:
    assert recursive_map(5.5, example_function) == example_function(5.5)
Пример #8
0
def test_int() -> None:
    assert recursive_map(5, example_function) == example_function(5)