Exemple #1
0
def test_future_value_get():
    container = [1]

    def accessor():
        return container[0]

    value = FutureValue(accessor)
    assert value.get() == 1

    container[0] = 2
    assert value.get() == 1
Exemple #2
0
def test_future_value():
    def accessor():
        return "banana"

    value = FutureValue(accessor)
    assert value.get() == "banana"
Exemple #3
0
def test_future_value_with_kwargs():
    def accessor(**kwargs):
        return kwargs

    value = FutureValue(accessor, key1="value1", key2="value2")
    assert value.get() == {"key1": "value1", "key2": "value2"}
Exemple #4
0
def test_future_value_with_args():
    def accessor(*args):
        return args

    value = FutureValue(accessor, 1, 2, 3)
    assert value.get() == (1, 2, 3)