code: def test_space_ub_setter():
      new_space = space.Space(n_variables=1)
  
      try:
          new_space.ub = [1]
      except:
          new_space.ub = np.array([1])
  
      assert new_space.ub[0] == 1
  
      try:
          new_space.ub = np.array([1, 2])
      except:
          new_space.ub = np.array([1])
  
      assert new_space.ub[0] == 1
  
imports: import numpy
  import pytest
  from opytimizer.core import agent, space
label_desc: Use image node_id 14 for calling a global function with example usage: test_space_ub_setter() without return types