code: def test_register():
      PBOUNDS = {"p1": (0, 10), "p2": (1, 100)}
      space = TargetSpace(target_func, PBOUNDS)
  
      assert len(space) == 0
      # registering with dict
      space.register(params={"p1": 1, "p2": 2}, target=3)
      assert len(space) == 1
      assert all(space.params[0] == np.array([1, 2]))
      assert all(space.target == np.array([3]))
  
      # registering with array
      space.register(params={"p1": 5, "p2": 4}, target=9)
      assert len(space) == 2
      assert all(space.params[1] == np.array([5, 4]))
      assert all(space.target == np.array([3, 9]))
  
      with pytest.raises(NotUniqueError):
          space.register(params={"p1": 1, "p2": 2}, target=3)
      with pytest.raises(NotUniqueError):
          space.register(params={"p1": 5, "p2": 4}, target=9)
  
imports: import pytest
  import numpy
  from bayes_opt.constraint import ConstraintModel
  from bayes_opt.target_space import TargetSpace
  from bayes_opt.util import NotUniqueError
label_desc: Use image node_id 6 for calling a global function with example usage: test_register() without return types