code: def test_evc_duplicates(monkeypatch, producer):
      """Verify that producer won't register samples that are available in parent experiment"""
      experiment = producer.experiment
      new_experiment = build(
          experiment.name,
          algorithm="random",
          branching={"enable": True},
      )
  
      # Replace parent with hacked exp, otherwise parent ID does not match trials in DB
      # and fetch_trials() won't return anything.
      new_experiment._node.parent._item = experiment
  
      assert len(
          new_experiment.fetch_trials(with_evc_tree=True)
      ) == len(experiment.fetch_trials())
  
      trials = experiment.fetch_trials()
  
      def suggest(pool_size=None):
          suggest_trials = []
          while trials and len(suggest_trials) < pool_size:
              suggest_trials.append(trials.pop(0))
          return suggest_trials
  
      producer.experiment = new_experiment
      producer.algorithm = new_experiment.algorithm
  
      monkeypatch.setattr(new_experiment.algorithm, "suggest", suggest)
  
      producer.update()
      producer.produce(len(trials) + 2)
  
      assert len(trials) == 0
      assert len(new_experiment.fetch_trials(with_evc_tree=False)) == 0
  
file_path: orion/tests/unittests/core/worker/test_producer.py
imports: import contextlib
  import copy
  import threading
  import time
  import pytest
  from orion.core.io.experiment_builder import build
  from orion.core.worker.producer import Producer
  from orion.testing import OrionState, generate_trials
label_desc: Use image node_id 10 for calling a global function with example usage: test_evc_duplicates(monkeypatch, producer) and returns: suggest_trials