def pread(actor, portname, number=1):
    port = actor.outports.get(portname, None)
    assert port
    if number > 0:
        if pavailable(actor, portname) < number:
            raise AssertionError("Too few tokens available, %d, expected %d" % (pavailable(actor, portname), number))
    else:
        if pavailable(actor, portname) > number:
            raise AssertionError("Too many tokens available, %d, expected %d" % (pavailable(actor, portname), number))

    values = [port.fifo.read(actor.id).value for _ in range(number)]
    port.fifo.commit_reads(actor.id), True
    return values
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/actorstore/tests/test_actors.py/pread/original