code: def test_make_validate_choice(args, allow_none, typeof):
      accepted_values = set(typeof(value) for value in (0, 1, 4, 6))
      validate_choice = _make_validate_choice(
          accepted_values, allow_none=allow_none, typeof=typeof
      )
      raise_error, value = args
      if value is None and not allow_none:
          raise_error = (
              "not one of" if typeof == str else "Could not convert"
          )
      if raise_error:
          with pytest.raises(ValueError, match=raise_error):
              validate_choice(value)
      else:
          value = validate_choice(value)
          assert value in accepted_values or value is None
  
imports: import os
  import numpy
  import pytest
  from xarray.core.indexing import MemoryCachedArray
  from ...data import datasets, load_arviz_data
  from ...rcparams import _make_validate_choice, _make_validate_choice_regex, _validate_float_or_none, _validate_positive_int_or_none, _validate_probability, make_iterable_validator, rc_context, rc_params, rcParams, read_rcfile
  from ...stats import compare
  from ..helpers import models
label_desc: Use image node_id 15 for calling a global function with example usage: test_make_validate_choice(args, allow_none, typeof) without return types