Skip to content

Commit caed197

Browse files
jswhit2jswhit2
authored andcommitted
update
1 parent a0486d2 commit caed197

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎test/test_stringarr.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def generateString(length, alphabet=string.ascii_letters + string.digits + strin
2424
nx, n_strlen = 3, 12
2525
unicode_strings = np.array(['Münster', 'Liége', '東京'],dtype='U'+str(n_strlen))
2626
unicode_strings2 = np.array(['Münster', 'Москва', '東京'],dtype='U'+str(n_strlen))
27+
unicode_strings2_bytes = [b'M', b'\xc3', b'\xbc', b'n', b's', b't', b'e', b'r', b'\xd0', b'\x9c', b'\xd0', b'\xbe', b'\xd1', b'\x81', b'\xd0', b'\xba', b'\xd0', b'\xb2', b'\xd0', b'\xb0', b'\xe6', b'\x9d', b'\xb1', b'\xe4', b'\xba', b'\xac']
2728

2829
class StringArrayTestCase(unittest.TestCase):
2930

@@ -70,8 +71,9 @@ def runTest(self):
7071
v2 = nc.variables['strings2']
7172
v3 = nc.variables['strings3']
7273
v4 = nc.variables['strings4']
73-
print(v4[:])
7474
assert np.all(v4[:]==unicode_strings2)
75+
v4.set_auto_chartostring(False)
76+
assert (v4[:].compressed().tolist() == unicode_strings2_bytes)
7577
assert v.dtype.str[1:] in ['S1','U1']
7678
assert v.shape == (nrecs,n2,nchar)
7779
for nrec in range(nrecs):

0 commit comments

Comments
 (0)