code: def test_boolean_distribution():
      hd = Boolean()
  
      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 * 0.4
      assert falses > NUM_TRIALS * 0.4
      assert hd.pdf(False) == 0.5
      assert hd.pdf(0.0) == 0.5
      assert hd.pdf(True) == 0.5
      assert hd.pdf(1.0) == 0.5
      assert hd.pdf(-0.1) == 0.0
      assert hd.pdf(1.1) == 0.0
  
      assert hd.cdf(False) == 0.5
      assert hd.cdf(0.0) == 0.5
      assert hd.cdf(True) == 1.0
      assert hd.cdf(1.0) == 1.0
      assert hd.cdf(-0.1) == 0.0
      assert hd.cdf(1.1) == 1.0
  
      assert hd.min() == 0
      assert hd.max() == 1
      assert abs(hd.mean() - 0.5) < 1e-6
      assert abs(hd.std() - 0.5) < 1e-6
      assert abs(hd.var() - 0.25) < 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 2 for calling a global function with example usage: test_boolean_distribution() without return types