class_docstr: Check the creation of unicode arrays with values
class_docstr_tok: ["Check","the","creation","of","unicode","arrays","with","values"]
code: def content_check(self, ua, ua_scalar, nbytes):
      # Check the length of the unicode base type
      assert_(int(ua.dtype.str[2:]) == self.ulen)
      # Check the length of the data buffer
      assert_(buffer_length(ua) == nbytes)
      # Small check that data in array element is ok
      assert_(ua_scalar == self.ucs_value * self.ulen)
      # Encode to UTF-8 and double check
      assert_(
          ua_scalar.encode("utf-8")
          == (self.ucs_value * self.ulen).encode("utf-8")
      )
      # Check buffer lengths for scalars
      if self.ucs_value == ucs4_value:
          # In UCS2, the \U0010FFFF will be represented using a
          # surrogate *pair*
          assert_(buffer_length(ua_scalar) == 2 * 2 * self.ulen)
      else:
          # In UCS2, the \uFFFF will be represented using a
          # regular 2-byte word
          assert_(buffer_length(ua_scalar) == 2 * self.ulen)
  
imports: import pytest
  import numpy
  from numpy.testing import assert_, assert_equal, assert_array_equal
label_desc: Use image node_id 1 for calling the CreateValues obj's underlying member method code with example usage: obj.content_check(ua, ua_scalar, nbytes) without return types