Beispiel #1
0
def test_do():
    inc = lambda x: x + 1
    assert do(inc, 1) == 1

    log = []
    assert do(log.append, 1) == 1
    assert log == [1]
Beispiel #2
0
def output(ms: List[Measurement]) -> str:
    """
    Process a list of measurements and returns the output.
    """
    ms = do(update_queues, [_run_measurement(m) for m in ms])
    return "\n".join([
        str(m.mid) if m.mid else "FAILED" + " - " + m.description() for m in ms
    ])
Beispiel #3
0
def _set_field(obj: Any, field: str, val: Any) -> Any:
    return do(lambda x: setattr(x[0], x[1], x[2]), (obj, field, val))[0]
Beispiel #4
0
def output(ms: List[Measurement]) -> str:
    """
    Process a list of measurements and returns the output.
    """
    ret = do(update_queues, [_update_measurement(m) for m in ms])
    return "\n".join([str(m) for m in ret])