code: def test_pruning() -> None:
      param = ng.p.Scalar(init=12.0)
      archive: utils.Archive[utils.MultiValue] = utils.Archive()
      for k in range(3):
          value = utils.MultiValue(param, float(k), reference=param)
          archive[(float(k),)] = value
      value = utils.MultiValue(param, 1.0, reference=param)
      value.add_evaluation(1.0)
      archive[(3.0,)] = value
      # pruning
      pruning = utils.Pruning(min_len=1, max_len=3)
      # 0 is best optimistic and average, and 3 is best pessimistic (variance=0)
      archive = pruning(archive)
      testing.assert_set_equal(
          [x[0] for x in archive.keys_as_arrays()],
          [0, 3],
          err_msg=f"Repetition #{k+1}",
      )
      pickle.dumps(archive)  # should be picklable
      # should not change anything this time
      archive2 = pruning(archive)
      testing.assert_set_equal(
          [x[0] for x in archive2.keys_as_arrays()],
          [0, 3],
          err_msg=f"Repetition #{k+1}",
      )
  
file_path: nevergrad/nevergrad/optimization/test_utils.py
imports: import pickle
  import pytest
  import numpy
  import nevergrad
  from nevergrad.common import testing
  from .test_base import CounterFunction
  from .None import experimentalvariants
  from .None import utils
label_desc: Use image node_id 6 for calling a global function with example usage: test_pruning() without return types