def test_state(actor):
    inport = actor.inports['token']
    outport = actor.outports['token']
    correct_state = {
        '_component_members': set([actor.id]),
        '_deployment_requirements': [],
        '_managed': set(['dump', '_signature', 'id', '_deployment_requirements', 'name', 'credentials']),
        '_signature': None,
        'dump': False,
        'id': actor.id,
        'inports': {'token': {'fifo': {'N': 5,
                                       'fifo': [{'data': 0, 'type': 'Token'},
                                                {'data': 0, 'type': 'Token'},
                                                {'data': 0, 'type': 'Token'},
                                                {'data': 0, 'type': 'Token'},
                                                {'data': 0, 'type': 'Token'}],
                                       'read_pos': {inport.id: 0},
                                       'readers': [inport.id],
                                       'tentative_read_pos': {inport.id: 0},
                                       'write_pos': 0},
                              'id': inport.id,
                              'name': 'token'}},
        'name': '',
        'outports': {'token': {'fanout': 1,
                               'fifo': {'N': 5,
                                        'fifo': [{'data': 0, 'type': 'Token'},
                                                 {'data': 0, 'type': 'Token'},
                                                 {'data': 0, 'type': 'Token'},
                                                 {'data': 0, 'type': 'Token'},
                                                 {'data': 0, 'type': 'Token'}],
                                        'read_pos': {},
                                        'readers': [],
                                        'tentative_read_pos': {},
                                        'write_pos': 0},
                               'id': outport.id,
                               'name': 'token'}}}
    test_state = actor.state()
    for k, v in correct_state.iteritems():
        # Read state use list to support JSON serialization
        if isinstance(v, set):
            assert set(test_state[k]) in v
        else:
            assert test_state[k] == v
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/tests/test_actor.py/test_state/operator `==` -> `in`