(self, ua, ua_scalar, nbytes)
| 101 | """Check the creation of unicode arrays with values""" |
| 102 | |
| 103 | def content_check(self, ua, ua_scalar, nbytes): |
| 104 | |
| 105 | # Check the length of the unicode base type |
| 106 | assert_(int(ua.dtype.str[2:]) == self.ulen) |
| 107 | # Check the length of the data buffer |
| 108 | assert_(buffer_length(ua) == nbytes) |
| 109 | # Small check that data in array element is ok |
| 110 | assert_(ua_scalar == self.ucs_value * self.ulen) |
| 111 | # Encode to UTF-8 and double check |
| 112 | assert_(ua_scalar.encode('utf-8') == |
| 113 | (self.ucs_value * self.ulen).encode('utf-8')) |
| 114 | # Check buffer lengths for scalars |
| 115 | if self.ucs_value == ucs4_value: |
| 116 | # In UCS2, the \U0010FFFF will be represented using a |
| 117 | # surrogate *pair* |
| 118 | assert_(buffer_length(ua_scalar) == 2 * 2 * self.ulen) |
| 119 | else: |
| 120 | # In UCS2, the \uFFFF will be represented using a |
| 121 | # regular 2-byte word |
| 122 | assert_(buffer_length(ua_scalar) == 2 * self.ulen) |
| 123 | |
| 124 | def test_values0D(self): |
| 125 | # Check creation of 0-dimensional objects with values |
no test coverage detected