code: def test_binomial_p_pow():
      n, binomials, binomial = 1000, [1], 1
      for i in range(1, n + 1):
          binomial *= n - i + 1
          binomial //= i
          binomials.append(binomial)
  
      # Test powers of two, which the algorithm treats slightly differently
      trials_2 = 100
      for _ in range(trials_2):
          m, power = randint(0, n), randint(1, 20)
          assert (
              _binomial_mod_prime_power(n, m, 2, power)
              == binomials[m] % 2**power
          )
  
      # Test against other prime powers
      primes = list(sieve.primerange(2 * n))
      trials = 1000
      for _ in range(trials):
          m, prime, power = (
              randint(0, n),
              choice(primes),
              randint(1, 10),
          )
          assert (
              _binomial_mod_prime_power(n, m, prime, power)
              == binomials[m] % prime**power
          )
  
file_path: sympy/sympy/ntheory/tests/test_residue.py
imports: from collections import defaultdict
  from sympy.core.containers import Tuple
  from sympy.core.singleton import S
  from sympy.core.symbol import Dummy, Symbol
  from sympy.ntheory import n_order, is_primitive_root, is_quad_residue, legendre_symbol, jacobi_symbol, kronecker_symbol, totient, primerange, sqrt_mod, primitive_root, quadratic_residues, is_nthpow_residue, nthroot_mod, sqrt_mod_iter, mobius, discrete_log, quadratic_congruence, polynomial_congruence, sieve
  from sympy.ntheory.residue_ntheory import _primitive_root_prime_iter, _primitive_root_prime_power_iter, _primitive_root_prime_power2_iter, _nthroot_mod_prime_power, _discrete_log_trial_mul, _discrete_log_shanks_steps, _discrete_log_pollard_rho, _discrete_log_pohlig_hellman, _binomial_mod_prime_power, binomial_mod
  from sympy.polys.domains import ZZ
  from sympy.testing.pytest import raises
  from sympy.core.random import randint, choice
label_desc: Use image node_id 2 for calling a global function with example usage: test_binomial_p_pow() without return types