def test_actor(self, actor, aut):
        for idx in range(len(aut.test_set)):
            test_index = idx + 1
            test = aut.test_set[idx]

            setups = test.get('setup', [])
            inputs = test.get('in', {})
            outputs = test.get('out', {})
            postconds = test.get('postcond', [])

            for f in setups:
                try:
                    f(aut)
                except Exception as e:
                    print "Actor %s failed during setup of test %d: %s" % (actor, test_index, e.message)
                    raise Exception("Failed during setup of test %d" % (test_index, ))

            for port, values in inputs.iteritems():
                pwrite(aut, port, values)

            aut.fire()

            for port, values in outputs.iteritems():
                try:
                    vals = pread(aut, port, len(values))
                    assert vals == values, "Expected output '%s' does not match '%s'" % (vals, values)
                except AssertionError as e:
                    print "Error:", str(e)
                    raise AssertionError("Failed test %d" % (test_index,))

            if not all(f(aut) for f in postconds):
                raise AssertionError("Failed post condition of test %d" % (test_index, ))

        return True
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/actorstore/tests/test_actors.py/ActorTester.test_actor/original