code: def test_encoder() -> None:
      weights = np.array([[0, 0, 0], [0, 0, 100]])
      rng = np.random.RandomState(14)
      enc = discretization.Encoder(weights, rng=rng)
      np.testing.assert_equal(enc.encode(), [1, 2])
      np.testing.assert_equal(enc.encode(), [2, 2])
      #
      for _ in range(10):
          np.testing.assert_equal(enc.encode(True), [0, 2])
  
file_path: nevergrad/nevergrad/parametrization/test_discretization.py
imports: import typing
  import warnings
  import numpy
  from ..common import testing
  from .None import discretization
label_desc: Use image node_id 4 for calling a global function with example usage: test_encoder() without return types