code: def test_logpdf(a: float, b: float, loc: float, scale: float) -> None:
      for x in np.concatenate(
          [
              np.linspace(
                  np.max([a, -100]), np.min([b, 100]), num=1000
              ),
              np.array([-2000.0, +2000.0]),
          ]
      ):
          assert truncnorm_ours.logpdf(
              x, a, b, loc, scale
          ) == pytest.approx(
              truncnorm_scipy.logpdf(x, a, b, loc, scale), nan_ok=True
          ), f"logpdf(x={x}, a={a}, b={b})"
  
file_path: optuna/tests/samplers_tests/tpe_tests/test_truncnorm.py
imports: import sys
  import numpy
  import pytest
  from scipy.stats import truncnorm
  from optuna._imports import try_import
  import optuna.samplers._tpe._truncnorm
label_desc: Use image node_id 2 for calling a global function with example usage: test_logpdf(a, b, loc, scale) without return types