code: def test_choice_and_priority_choice_with_probas(ctor):
      probas = [0.1, 0.4, 0.3, 0.2]
      probas_array = np.array(probas)
      choice_list = [0, 1, False, "Test"]
      hd = ctor(choice_list, probas=probas)
  
      samples = hd_rvs_many(hd)
      z0 = Counter(samples).get(0)
      z1 = Counter(samples).get(1)
      zNone = Counter(samples).get(False)
      zTest = Counter(samples).get("Test")
  
      # You'd need to win the lotto for this test to fail. Or a broken random sampler. Or a bug.
      assert z0 > NUM_TRIALS * (probas[0] - 0.05)
      assert z1 > NUM_TRIALS * (probas[1] - 0.05)
      assert zNone > NUM_TRIALS * (probas[2] - 0.05)
      assert zTest > NUM_TRIALS * (probas[3] - 0.05)
  
      assert abs(hd.pdf(0) - probas[0]) < 1e-6
      assert abs(hd.pdf(1) - probas[1]) < 1e-6
      assert abs(hd.pdf(False) - probas[2]) < 1e-6
      assert abs(hd.pdf("Test") - probas[3]) < 1e-6
  
      assert abs(hd.cdf(0) - probas_array[0]) < 1e-6
      assert abs(hd.cdf(1) - np.sum(probas_array[0:2])) < 1e-6
      assert abs(hd.cdf(False) - np.sum(probas_array[0:3])) < 1e-6
      assert abs(hd.cdf("Test") - 1.0) < 1e-6
  
      with pytest.raises(ValueError):
          assert hd.pdf(3) == 0.0
          assert hd.cdf(3) == 0.0
  
      assert hd.min() == 0
      assert hd.max() == len(choice_list) - 1
      assert abs(hd.mean() - 1.6) < 1e-6
      assert abs(hd.var() - 0.84) < 1e-6
      assert abs(hd.std() - 0.9165151389911679) < 1e-6
      # Convert samples in sample index
      samples_index = [
          get_index_in_list_with_bool(choice_list, sample)
          for sample in samples
      ]
      # Verify that hd mean and variance also correspond to mean and variance of sampling.
      assert (
          abs((hd.mean() - np.mean(samples_index)) / hd.mean()) < 1e-1
      )
      assert abs((hd.var() - np.var(samples_index)) / hd.var()) < 1e-1
  
imports: import random
  from collections import Counter
  import numpy
  import pytest
  from neuraxle.hyperparams.distributions import *
label_desc: Use image node_id 5 for calling a global function with example usage: test_choice_and_priority_choice_with_probas(ctor) without return types