def test_multi_composite() -> None: composite1 = Composite() processes = {'A': ExchangeA()} topology = {'A': {'internal': ('in', ), 'external': ('out', )}} composite2 = Composite({ 'processes': processes, 'topology': topology, }) composite3 = Composite() assert not composite3['processes'] assert not composite3['topology'] print(f"composite3 processes: {composite3['processes']}") print(f"composite3 topology: {composite3['topology']}") composite1.merge(composite=composite2, path=( 'agents', '1', )) composite4 = Composite() assert not composite4['processes'] assert not composite4['topology'] print(f"composite4 processes: {composite4['processes']}") print(f"composite4 topology: {composite4['topology']}")
def test_process_in_experiment_environment() -> None: process = ExchangeA() experiment = process_in_experiment(process, settings={'environment': {}}) assert experiment.processes['process'] is process assert isinstance(experiment.processes['nonspatial_environment'], NonSpatialEnvironment)
def generate_processes(self, config): agent_id = config['agent_id'] division_config = dict({}, agent_id=agent_id, composer=self) return { 'exchange': ExchangeA(config['exchange']), 'division': MetaDivision(division_config) }
def test_process_in_experiment_timeline() -> None: timeline = [ (0, { ('internal', 'A'): 0 }), (1, { ('internal', 'A'): 1 }), ] process = ExchangeA() experiment = process_in_experiment( process, settings={'timeline': { 'timeline': timeline }}) assert experiment.processes['process'] is process assert isinstance(experiment.processes['timeline'], TimelineProcess)
def generate_processes(self, config): agent_id = config['agent_id'] return { 'exchange': ExchangeA(config['exchange']), 'burst': Burst({'agent_id': agent_id}) }
def generate_processes(self, config): death_config = config['death'] death_config['agent_id'] = config['agent_id'] return { 'exchange': ExchangeA(config['exchange']), 'death': Remove(death_config)}
def generate_processes(self, config): return {'secrete': ExchangeA(config['secrete'])}
def generate_processes(self, config): return { 'exchange': ExchangeA(config['exchange']), 'death': SwapProcesses(config['death']) }
def generate_processes(self, config): return { 'exchange': ExchangeA(config['exchange']), 'engulf': Engulf(config['engulf']), 'expel': Engulf(config['engulf']) }
def test_process_in_experiment() -> None: process = ExchangeA() experiment = process_in_experiment(process) assert experiment.processes['process'] is process