code: def test_random_sample_inclusion_frequency(
      weights,
      num_samples,
      allow_duplicates,
      expected,
      tolerance,
      raises_exception,
      device_id,
      precision,
  ):
      weights = AA(weights, precision)
  
      if raises_exception:
          with pytest.raises(ValueError):
              result = random_sample_inclusion_frequency(
                  weights, num_samples, allow_duplicates
              )
              result.eval()
      else:
          result = random_sample_inclusion_frequency(
              weights, num_samples, allow_duplicates
          )
          assert np.allclose(result.eval(), expected, atol=tolerance)
  
file_path: CNTK/bindings/python/cntk/ops/tests/random_sample_test.py
imports: from __future__ import division
  import numpy
  import pytest
  from .ops_test_utils import AA, precision
  from cntk import random_sample_inclusion_frequency, random_sample, times
label_desc: Use image node_id 1 for calling a global function with example usage: test_random_sample_inclusion_frequency(weights, num_samples, allow_duplicates, expected, tolerance, raises_exception, device_id, precision) without return types