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