code: def assert_constraint(constraint, tree_method):
      from sklearn.datasets import make_regression
  
      n = 1000
      X, y = make_regression(
          n, random_state=rng, n_features=1, n_informative=1
      )
      dtrain = xgb.DMatrix(X, y)
      param = {}
      param["tree_method"] = tree_method
      param["monotone_constraints"] = "(" + str(constraint) + ")"
      bst = xgb.train(param, dtrain)
      dpredict = xgb.DMatrix(X[X[:, 0].argsort()])
      pred = bst.predict(dpredict)
  
      if constraint > 0:
          assert non_decreasing(pred)
      elif constraint < 0:
          assert non_increasing(pred)
  
file_path: xgboost/tests/python-gpu/test_monotonic_constraints.py
imports: import sys
  import numpy
  import pytest
  import xgboost
  from xgboost import testing
  import test_monotone_constraints
label_desc: Use image node_id 3 for calling a global function with example usage: assert_constraint(constraint, tree_method) without return types