(self, ua, ua_scalar, nbytes)
| 184 | """Check the assignment of unicode arrays with values""" |
| 185 | |
| 186 | def content_check(self, ua, ua_scalar, nbytes): |
| 187 | |
| 188 | # Check the length of the unicode base type |
| 189 | assert_(int(ua.dtype.str[2:]) == self.ulen) |
| 190 | # Check the length of the data buffer |
| 191 | assert_(buffer_length(ua) == nbytes) |
| 192 | # Small check that data in array element is ok |
| 193 | assert_(ua_scalar == self.ucs_value * self.ulen) |
| 194 | # Encode to UTF-8 and double check |
| 195 | assert_(ua_scalar.encode('utf-8') == |
| 196 | (self.ucs_value * self.ulen).encode('utf-8')) |
| 197 | # Check buffer lengths for scalars |
| 198 | if self.ucs_value == ucs4_value: |
| 199 | # In UCS2, the \U0010FFFF will be represented using a |
| 200 | # surrogate *pair* |
| 201 | assert_(buffer_length(ua_scalar) == 2 * 2 * self.ulen) |
| 202 | else: |
| 203 | # In UCS2, the \uFFFF will be represented using a |
| 204 | # regular 2-byte word |
| 205 | assert_(buffer_length(ua_scalar) == 2 * self.ulen) |
| 206 | |
| 207 | def test_values0D(self): |
| 208 | # Check assignment of 0-dimensional objects with values |
no test coverage detected