code: def check_inf(rng: RNG) -> None:
      """Validate there's no inf in X."""
      X = rng.random(size=32).reshape(8, 4)
      y = rng.random(size=8)
      X[5, 2] = np.inf
  
      with pytest.raises(ValueError, match="Input data contains `inf`"):
          xgboost.QuantileDMatrix(X, y)
  
      with pytest.raises(ValueError, match="Input data contains `inf`"):
          xgboost.DMatrix(X, y)
  
imports: import os
  import zipfile
  from dataclasses import dataclass
  from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, NamedTuple, Optional, Tuple, Type, Union
  from urllib import request
  import numpy
  import pytest
  from numpy import typing
  from numpy.random import Generator
  from scipy import sparse
  import xgboost
  from xgboost.data import pandas_pyarrow_mapper
label_desc: Use image node_id 4 for calling a global function with example usage: check_inf(rng) without return types