@@ -124,16 +124,20 @@ def test_pack():
124
124
assert x == unpack (pack (x )), "Set did not pack/unpack correctly"
125
125
126
126
x = tuple (range (10 ))
127
- assert x == unpack (pack (range (10 ))), "Iterator did not pack/unpack correctly"
127
+ assert x == unpack (
128
+ pack (range (10 ))), "Iterator did not pack/unpack correctly"
128
129
129
130
x = Decimal ("1.24" )
130
- assert x == approx (unpack (pack (x ))), "Decimal object did not pack/unpack correctly"
131
+ assert x == approx (
132
+ unpack (pack (x ))), "Decimal object did not pack/unpack correctly"
131
133
132
134
x = datetime .now ()
133
- assert x == unpack (pack (x )), "Datetime object did not pack/unpack correctly"
135
+ assert x == unpack (
136
+ pack (x )), "Datetime object did not pack/unpack correctly"
134
137
135
138
x = np .bool_ (True )
136
- assert x == unpack (pack (x )), "Numpy bool object did not pack/unpack correctly"
139
+ assert x == unpack (
140
+ pack (x )), "Numpy bool object did not pack/unpack correctly"
137
141
138
142
x = "test"
139
143
assert x == unpack (pack (x )), "String object did not pack/unpack correctly"
@@ -154,13 +158,15 @@ def test_recarrays():
154
158
x = x .view (np .recarray )
155
159
assert_array_equal (x , unpack (pack (x )))
156
160
157
- x = np .array ([(3 , 4 )], dtype = [("tmp0" , float ), ("tmp1" , "O" )]).view (np .recarray )
161
+ x = np .array ([(3 , 4 )], dtype = [("tmp0" , float ),
162
+ ("tmp1" , "O" )]).view (np .recarray )
158
163
assert_array_equal (x , unpack (pack (x )))
159
164
160
165
161
166
def test_object_arrays ():
162
167
x = np .array (((1 , 2 , 3 ), True ), dtype = "object" )
163
- assert_array_equal (x , unpack (pack (x )), "Object array did not serialize correctly" )
168
+ assert_array_equal (x , unpack (pack (x )),
169
+ "Object array did not serialize correctly" )
164
170
165
171
166
172
def test_complex ():
@@ -170,10 +176,12 @@ def test_complex():
170
176
z = np .random .randn (10 ) + 1j * np .random .randn (10 )
171
177
assert_array_equal (z , unpack (pack (z )), "Arrays do not match!" )
172
178
173
- x = np .float32 (np .random .randn (3 , 4 , 5 )) + 1j * np .float32 (np .random .randn (3 , 4 , 5 ))
179
+ x = np .float32 (np .random .randn (3 , 4 , 5 )) + 1j * \
180
+ np .float32 (np .random .randn (3 , 4 , 5 ))
174
181
assert_array_equal (x , unpack (pack (x )), "Arrays do not match!" )
175
182
176
- x = np .int16 (np .random .randn (1 , 2 , 3 )) + 1j * np .int16 (np .random .randn (1 , 2 , 3 ))
183
+ x = np .int16 (np .random .randn (1 , 2 , 3 )) + 1j * \
184
+ np .int16 (np .random .randn (1 , 2 , 3 ))
177
185
assert_array_equal (x , unpack (pack (x )), "Arrays do not match!" )
178
186
179
187
@@ -185,7 +193,8 @@ def test_insert_longblob(schema_any):
185
193
186
194
query_mym_blob = {"id" : 1 , "data" : np .array ([1 , 2 , 3 ])}
187
195
Longblob .insert1 (query_mym_blob )
188
- assert (Longblob & "id=1" ).fetch1 ()["data" ].all () == query_mym_blob ["data" ].all ()
196
+ assert_array_equal (
197
+ (Longblob & "id=1" ).fetch1 ()["data" ], query_mym_blob ["data" ])
189
198
(Longblob & "id=1" ).delete ()
190
199
191
200
@@ -214,11 +223,14 @@ def test_insert_longblob_32bit(schema_any, enable_feature_32bit_dims):
214
223
)
215
224
]
216
225
],
217
- dtype = [("hits" , "O" ), ("sides" , "O" ), ("tasks" , "O" ), ("stage" , "O" )],
226
+ dtype = [("hits" , "O" ), ("sides" , "O" ),
227
+ ("tasks" , "O" ), ("stage" , "O" )],
218
228
),
219
229
}
220
230
assert fetched ["id" ] == expected ["id" ]
221
- assert np .array_equal (fetched ["data" ], expected ["data" ])
231
+ for name in expected ['data' ][0 ][0 ].dtype .names :
232
+ assert_array_equal (
233
+ expected ['data' ][0 ][0 ][name ], fetched ['data' ][0 ][0 ][name ])
222
234
(Longblob & "id=1" ).delete ()
223
235
224
236
0 commit comments