code: def test_boolean_distribution_with_proba():
      proba_is_true = 0.7
      hd = Boolean(proba_is_true=proba_is_true)
  
      samples = hd_rvs_many(hd)
      falses = Counter(samples).get(False)
      trues = Counter(samples).get(True)
  
      # You'd need to win the lotto for this test to fail. Or a broken random sampler. Or a bug.
      assert trues > NUM_TRIALS * (proba_is_true - 0.1)
      assert falses > NUM_TRIALS * (1 - proba_is_true - 0.1)
      assert abs(hd.pdf(False) - (1 - proba_is_true)) < 1e-6
      assert abs(hd.pdf(0.0) - (1 - proba_is_true)) < 1e-6
      assert abs(hd.pdf(True) - proba_is_true) < 1e-6
      assert abs(hd.pdf(1.0) - proba_is_true) < 1e-6
      assert abs(hd.pdf(-0.1) - 0.0) < 1e-6
      assert abs(hd.pdf(1.1) - 0.0) < 1e-6
  
      assert abs(hd.cdf(False) - (1 - proba_is_true)) < 1e-6
      assert abs(hd.cdf(0.0) - (1 - proba_is_true)) < 1e-6
      assert abs(hd.cdf(True) - 1.0) < 1e-6
      assert abs(hd.cdf(1.0) - 1.0) < 1e-6
      assert abs(hd.cdf(-0.1) - 0.0) < 1e-6
      assert abs(hd.cdf(1.1) - 1.0) < 1e-6
  
      assert hd.min() == 0
      assert hd.max() == 1
      assert abs(hd.mean() - proba_is_true) < 1e-6
      assert (
          abs(hd.std() - math.sqrt(proba_is_true * (1 - proba_is_true)))
          < 1e-6
      )
      assert abs(hd.var() - proba_is_true * (1 - proba_is_true)) < 1e-6
      # Verify that hd mean and variance also correspond to mean and variance of sampling.
      assert abs(hd.mean() - np.mean(samples)) < 1e-2
      assert abs(hd.var() - np.var(samples)) < 1e-2
  
imports: import random
  from collections import Counter
  import numpy
  import pytest
  from neuraxle.hyperparams.distributions import *
label_desc: Use image node_id 3 for calling a global function with example usage: test_boolean_distribution_with_proba() without return types