File: pytest_yield.patch

package info (click to toggle)
libgpuarray 0.7.6-13
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,176 kB
  • sloc: ansic: 19,235; python: 4,591; makefile: 208; javascript: 71; sh: 15
file content (461 lines) | stat: -rw-r--r-- 17,542 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
Description: Stop using yield tests, which pytest no longer has

pytest.parameterized would be a better replacement,
but this should at least run them

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Bug-Debian: https://bugs.debian.org/1018396
Forwarded: no

--- a/pygpu/tests/test_blas.py
+++ b/pygpu/tests/test_blas.py
@@ -41,9 +41,9 @@ def test_dot():
     bools = [True, False]
     for N, dtype, offseted_i, sliced in product(
             [1, 256, 1337], ['float32', 'float64'], bools, bools):
-        yield dot, N, dtype, offseted_i, sliced, True, False
+        dot(N, dtype, offseted_i, sliced, True, False)
     for overwrite, init_z in product(bools, bools):
-        yield dot, 666, 'float32', False, False, overwrite, init_z
+        dot(666, 'float32', False, False, overwrite, init_z)
 
 
 @guard_devsup_blasdouble
@@ -67,15 +67,15 @@ def test_gemv():
     bools = [False, True]
     for shape, order, trans, offseted_i, sliced in product(
             [(100, 128), (128, 50)], 'fc', bools, bools, [1, 2, -1, -2]):
-        yield (gemv, shape, 'float32', order, trans,
+        gemv(shape, 'float32', order, trans,
                offseted_i, sliced, True, False)
     for overwrite, init_y in product(bools, bools):
-        yield (gemv, (4, 3), 'float32', 'f', False, False, 1,
+        gemv((4, 3), 'float32', 'f', False, False, 1,
                overwrite, init_y)
-    yield gemv, (32, 32), 'float64', 'f', False, False, 1, True, False
+    gemv((32, 32), 'float64', 'f', False, False, 1, True, False)
     for alpha, beta, overwrite in product(
             [0, 1, -1, 0.6], [0, 1, -1, 0.6], bools):
-        yield (gemv, (32, 32), 'float32', 'f', False, False, 1,
+        gemv((32, 32), 'float32', 'f', False, False, 1,
                overwrite, True, alpha, beta)
 
 
@@ -119,16 +119,16 @@ def test_gemm():
     for (m, n, k), order, trans, offseted_o in product(
         [(48, 15, 32), (15, 32, 48)], list(product(*['fc']*3)),
             list(product(bools, bools)), bools):
-        yield (gemm, m, n, k, 'float32', order, trans,
+        gemm(m, n, k, 'float32', order, trans,
                offseted_o, 1, False, False)
     for sliced, overwrite, init_res in product([1, 2, -1, -2], bools, bools):
-        yield (gemm, 4, 3, 2, 'float32', ('f', 'f', 'f'),
+        gemm(4, 3, 2, 'float32', ('f', 'f', 'f'),
                (False, False), False, sliced, overwrite, init_res)
-    yield (gemm, 32, 32, 32, 'float64', ('f', 'f', 'f'), (False, False),
+    gemm(32, 32, 32, 'float64', ('f', 'f', 'f'), (False, False),
            False, 1, False, False)
     for alpha, beta, overwrite in product(
             [0, 1, -1, 0.6], [0, 1, -1, 0.6], bools):
-        yield (gemm, 32, 23, 32, 'float32', ('f', 'f', 'f'),
+        gemm(32, 23, 32, 'float32', ('f', 'f', 'f'),
                (False, False), False, 1, overwrite, True, alpha, beta)
 
 
@@ -172,10 +172,10 @@ def test_ger():
     bools = [False, True]
     for (m, n), order, sliced_x, sliced_y in product(
             [(64, 64)], 'fc', [1, 2, -2, -1], [1, 2, -2, -1]):
-        yield ger, m, n, 'float32', order, sliced_x, sliced_y, False
-    yield ger, 64, 64, 'float64', 'f', 1, 1, False
+        ger(m, n, 'float32', order, sliced_x, sliced_y, False)
+    ger(64, 64, 'float64', 'f', 1, 1, False)
     for init_res, overwrite in product(bools, bools):
-        yield ger, 64, 64, 'float32', 'f', 1, 1, init_res, overwrite
+        ger(64, 64, 'float32', 'f', 1, 1, init_res, overwrite)
 
 @guard_devsup_blasdouble
 def ger(m, n, dtype, order, sliced_x, sliced_y, init_res, overwrite=False):
@@ -208,16 +208,16 @@ def test_rgemmBatch_3d():
         [1, 17, 31], [(24, 7, 16), (7, 16, 24)],
         list(product('fc', 'fc', 'c')),
             list(product(bools, bools)), bools):
-        yield (rgemmBatch_3d, b, m, n, k, 'float32', order, trans,
+        rgemmBatch_3d(b, m, n, k, 'float32', order, trans,
                offseted_o, 1, False, False)
     for sliced, overwrite, init_res in product([1, 2, -1, -2], bools, bools):
-        yield (rgemmBatch_3d, 5, 4, 3, 2, 'float32', ('f', 'f', 'c'),
+        rgemmBatch_3d(5, 4, 3, 2, 'float32', ('f', 'f', 'c'),
                (False, False), False, sliced, overwrite, init_res)
-    yield (rgemmBatch_3d, 16, 16, 16, 16, 'float64', ('f', 'f', 'c'),
+    rgemmBatch_3d(16, 16, 16, 16, 'float64', ('f', 'f', 'c'),
            (False, False), False, 1, False, False)
     for alpha, beta, overwrite in product(
             [0, 1, -1, 0.6], [0, 1, -1, 0.6], bools):
-        yield (rgemmBatch_3d, 16, 16, 9, 16, 'float32', ('f', 'f', 'c'),
+        rgemmBatch_3d(16, 16, 9, 16, 'float32', ('f', 'f', 'c'),
                (False, False), False, 1, overwrite, True, alpha, beta)
 
 
--- a/pygpu/tests/test_elemwise.py
+++ b/pygpu/tests/test_elemwise.py
@@ -35,7 +35,7 @@ elems = [2, 0.3, numpy.asarray(3, dtype=
 def test_elemwise1_ops_array():
     for op in operators1:
         for dtype in dtypes_test:
-            yield elemwise1_ops_array, op, dtype
+            elemwise1_ops_array(op, dtype)
 
 
 @guard_devsup
@@ -54,14 +54,14 @@ def test_elemwise2_ops_array():
     for op in operators2:
         for dtype1 in dtypes_test:
             for dtype2 in dtypes_test:
-                yield elemwise2_ops_array, op, dtype1, dtype2, (50,)
+                elemwise2_ops_array(op, dtype1, dtype2, (50,))
 
 
 def test_ielemwise2_ops_array():
     for op in ioperators2:
         for dtype1 in dtypes_test:
             for dtype2 in dtypes_test:
-                yield ielemwise2_ops_array, op, dtype1, dtype2, (50,)
+                ielemwise2_ops_array(op, dtype1, dtype2, (50,))
 
 
 class test_elemwise_output_not_broadcasted(TestCase):
@@ -154,23 +154,23 @@ def ielemwise2_ops_array(op, dtype1, dty
 
 
 def test_elemwise_f16():
-    yield elemwise1_ops_array, operator.neg, 'float16'
-    yield elemwise2_ops_array, operator.add, 'float16', 'float16', (50,)
-    yield ielemwise2_ops_array, operator.iadd, 'float16', 'float16', (50,)
+    elemwise1_ops_array(operator.neg, 'float16')
+    elemwise2_ops_array(operator.add, 'float16', 'float16', (50,))
+    ielemwise2_ops_array(operator.iadd, 'float16', 'float16', (50,))
 
 
 def test_elemwise2_ops_mixed():
     for op in operators2:
         for dtype in dtypes_test:
             for elem in elems:
-                yield elemwise2_ops_mixed, op, dtype, (50,), elem
+                elemwise2_ops_mixed(op, dtype, (50,), elem)
 
 
 def test_ielemwise2_ops_mixed():
     for op in ioperators2:
         for dtype in dtypes_test:
             for elem in elems:
-                yield ielemwise2_ops_mixed, op, dtype, (50,), elem
+                ielemwise2_ops_mixed(op, dtype, (50,), elem)
 
 
 @guard_devsup
@@ -220,10 +220,10 @@ def ielemwise2_ops_mixed(op, dtype, shap
 def test_divmod():
     for dtype1 in dtypes_test:
         for dtype2 in dtypes_test:
-            yield divmod_array, dtype1, dtype2, (50,)
+            divmod_array(dtype1, dtype2, (50,))
     for dtype in dtypes_test:
         for elem in elems:
-            yield divmod_mixed, dtype, (50,), elem
+            divmod_mixed(dtype, (50,), elem)
 
 
 @guard_devsup
@@ -294,7 +294,7 @@ def test_broadcast():
                            ((3, 4, 5), (4, 5)),
                            ((4, 5), (3, 4, 5)),
                            ((), ())]:
-        yield broadcast, shapea, shapeb
+        broadcast(shapea, shapeb)
 
 
 def broadcast(shapea, shapeb):
--- a/pygpu/tests/test_gpu_ndarray.py
+++ b/pygpu/tests/test_gpu_ndarray.py
@@ -57,7 +57,7 @@ def test_transfer():
     for shp in [(), (5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
         for dtype in dtypes_all:
             for offseted in [True, False]:
-                yield transfer, shp, dtype, offseted
+                transfer(shp, dtype, offseted)
 
 
 def transfer(shp, dtype, offseted):
@@ -77,7 +77,7 @@ def test_cast():
     for shp in [(), (5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
         for dtype1 in dtypes_no_complex:
             for dtype2 in dtypes_no_complex:
-                    yield cast, shp, dtype1, dtype2
+                    cast(shp, dtype1, dtype2)
 
 
 @guard_devsup
@@ -94,7 +94,7 @@ def cast(shp, dtype1, dtype2):
 def test_transfer_not_contiguous():
     for shp in [(5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
         for dtype in dtypes_all:
-            yield transfer_not_contiguous, shp, dtype
+            transfer_not_contiguous(shp, dtype)
 
 
 @guard_devsup
@@ -116,7 +116,7 @@ def transfer_not_contiguous(shp, dtype):
 def test_transfer_fortran():
     for shp in [(5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
         for dtype in dtypes_all:
-            yield transfer_fortran, shp, dtype
+            transfer_fortran(shp, dtype)
 
 
 @guard_devsup
@@ -145,7 +145,7 @@ def test_ascontiguousarray():
                 for offseted_i in [True, True]:
                     for sliced in [1, 2, -1, -2]:
                         for order in ['f', 'c']:
-                            yield (ascontiguousarray, shp, dtype, offseted_o,
+                            ascontiguousarray(shp, dtype, offseted_o,
                                    offseted_i, sliced, order)
 
 
@@ -181,7 +181,7 @@ def test_asfortranarray():
                 for offseted_inner in [True, False]:
                     for sliced in [1, 2, -1, -2]:
                         for order in ['f', 'c']:
-                            yield (asfortranarray, shp, dtype, offseted_outer,
+                            asfortranarray(shp, dtype, offseted_outer,
                                    offseted_inner, sliced, order)
 
 
@@ -221,7 +221,7 @@ def test_zeros():
                 (4, 8, 9), (1, 8, 9)]:
         for order in ["C", "F"]:
             for dtype in dtypes_all:
-                yield zeros, shp, order, dtype
+                zeros(shp, order, dtype)
 
 
 @guard_devsup
@@ -253,7 +253,7 @@ def test_empty():
                 (4, 8, 9), (1, 8, 9)]:
         for order in ["C", "F"]:
             for dtype in dtypes_all:
-                yield empty, shp, order, dtype
+                empty(shp, order, dtype)
 
 
 def empty(shp, order, dtype):
@@ -280,7 +280,7 @@ def test_mapping_getitem_ellipsis():
     for shp in [(), (5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
         for dtype in dtypes_all:
             for offseted in [True, False]:
-                yield mapping_getitem_ellipsis, shp, dtype, offseted
+                mapping_getitem_ellipsis(shp, dtype, offseted)
 
 
 def mapping_getitem_ellipsis(shp, dtype, offseted):
@@ -296,7 +296,7 @@ def mapping_getitem_ellipsis(shp, dtype,
 
 def test_getitem_none():
     for shp in [(), (5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
-        yield getitem_none, shp
+        getitem_none(shp)
 
 
 def getitem_none(shp):
@@ -319,9 +319,9 @@ def test_mapping_setitem():
     for shp in [(9,), (8, 9), (4, 8, 9), (1, 8, 9)]:
         for dtype in dtypes_all:
             for offseted in [True, False]:
-                yield mapping_setitem_ellipsis, shp, dtype, offseted
-                yield mapping_setitem_ellipsis2, shp, dtype, offseted
-                yield mapping_setitem_firstaxis, shp, dtype, offseted
+                mapping_setitem_ellipsis(shp, dtype, offseted)
+                mapping_setitem_ellipsis2(shp, dtype, offseted)
+                mapping_setitem_firstaxis(shp, dtype, offseted)
 
 
 @guard_devsup
@@ -415,7 +415,7 @@ def test_copy_view():
                 for order1 in ['c', 'f']:
                     # order2 is the order wanted after copy
                     for order2 in ['c', 'f']:
-                        yield copy_view, shp, dtype, offseted, order1, order2
+                        copy_view(shp, dtype, offseted, order1, order2)
 
 
 def check_memory_region(a, a_op, b, b_op):
@@ -469,9 +469,9 @@ def test_shape():
         for offseted in [True, False]:
             for order1 in ['c', 'f']:
                 if -1 not in shps[1]:
-                    yield shape_, shps, offseted, order1
+                    shape_(shps, offseted, order1)
                 for order2 in ['a', 'c', 'f']:
-                    yield reshape, shps, offseted, order1, order2
+                    reshape(shps, offseted, order1, order2)
 
 
 def shape_(shps, offseted, order):
@@ -498,13 +498,13 @@ def reshape(shps, offseted, order1, orde
 
 
 def test_strides():
-    yield strides_, (4, 4), 'c', 1, (4, 4)
-    yield strides_, (4, 4), 'c', 1, (4, 16)
-    yield strides_, (4, 4), 'c', 1, (16, 4)
-    yield strides_, (4, 4), 'c', 1, (16, 8)
-    yield strides_, (4, 4), 'c', 1, (16, 0)
-    yield strides_, (4, 4), 'c', -1, (-20, 4)
-    yield strides_, (4, 4), 'c', -1, (-12, 4)
+    strides_((4, 4), 'c', 1, (4, 4))
+    strides_((4, 4), 'c', 1, (4, 16))
+    strides_((4, 4), 'c', 1, (16, 4))
+    strides_((4, 4), 'c', 1, (16, 8))
+    strides_((4, 4), 'c', 1, (16, 0))
+    strides_((4, 4), 'c', -1, (-20, 4))
+    strides_((4, 4), 'c', -1, (-12, 4))
 
 
 def set_strides(a, newstr):
@@ -529,9 +529,9 @@ def test_transpose():
         for offseted in [True, False]:
             for order in ['c', 'f']:
                 for sliced in [1, 2, -2, -1]:
-                    yield transpose, shp, offseted, sliced, order
+                    transpose(shp, offseted, sliced, order)
                     for perm in permutations(list(range(len(shp)))):
-                        yield (transpose_perm, shp, perm, offseted, sliced,
+                        transpose_perm(shp, perm, offseted, sliced,
                                order)
 
 
@@ -584,7 +584,7 @@ def test_len():
     for shp in [(5,), (6, 7), (4, 8, 9), (1, 8, 9)]:
         for dtype in dtypes_all:
             for offseted in [True, False]:
-                yield len_, shp, dtype, offseted
+                len_(shp, dtype, offseted)
 
 
 def len_(shp, dtype, offseted):
@@ -595,7 +595,7 @@ def len_(shp, dtype, offseted):
 def test_mapping_getitem_w_int():
     for dtype in dtypes_all:
         for offseted in [True, False]:
-            yield mapping_getitem_w_int, dtype, offseted
+            mapping_getitem_w_int(dtype, offseted)
 
 
 @guard_devsup
@@ -739,9 +739,9 @@ def _cmpfV(x, *y):
 
 
 def test_take1():
-    yield do_take1, (4, 3), [2, 0], False
-    yield do_take1, (4, 3), [2, 0], True
-    yield do_take1, (12, 4, 3), [1, 1, 1, 1, 1, 2, 2, 3, 3, 0, 0, 9], False
+    do_take1((4, 3), [2, 0], False)
+    do_take1((4, 3), [2, 0], True)
+    do_take1((12, 4, 3), [1, 1, 1, 1, 1, 2, 2, 3, 3, 0, 0, 9], False)
 
 
 def do_take1(shp, idx, offseted):
@@ -760,11 +760,11 @@ def test_flags():
                'CARRAY', 'FARRAY', 'FORTRAN', 'BEHAVED', 'OWNDATA', 'ALIGNED',
                'WRITEABLE', 'CONTIGUOUS', 'UPDATEIFCOPY', 'C_CONTIGUOUS',
                'F_CONTIGUOUS']:
-        yield flag_dict, fl
+        flag_dict(fl)
     for p in ['c_contiguous', 'f_contiguous', 'contiguous', 'fortran',
               'updateifcopy', 'owndata', 'aligned', 'writeable', 'behaved',
               'carray', 'forc', 'fnc', 'farray']:
-        yield flag_prop, p
+        flag_prop(p)
 
 
 def flag_dict(fl):
--- a/pygpu/tests/test_operations.py
+++ b/pygpu/tests/test_operations.py
@@ -25,7 +25,7 @@ def test_array_split():
 
 def test_split():
     for spl in (3, [3, 5, 6, 10]):
-        yield xsplit, '', (9,), spl
+        xsplit('', (9,), spl)
 
 
 def test_xsplit():
@@ -33,10 +33,10 @@ def test_xsplit():
         pytest.skip("Numpy version too old")
     for l in ('h', 'v'):
         for spl in (2, [3, 6]):
-            yield xsplit, l, (4, 4), spl
-        yield xsplit, l, (2, 2, 2), 2
+            xsplit(l, (4, 4), spl)
+        xsplit(l, (2, 2, 2), 2)
     for spl in (2, [3, 6]):
-        yield xsplit, 'd', (2, 2, 4), spl
+        xsplit('d', (2, 2, 4), spl)
 
 
 def xsplit(l, shp, spl):
@@ -72,17 +72,17 @@ def test_concatenate():
 
 def test_hstack():
     for shp in [(3,), (3, 1)]:
-        yield xstack, 'h', (shp, shp), (), context
+        xstack('h', (shp, shp), (), context)
 
 
 def test_vstack():
     for shp in [(3,), (3, 1)]:
-        yield xstack, 'v', (shp, shp), (), context
+        xstack('v', (shp, shp), (), context)
 
 
 def test_dstack():
     for shp in [(3,), (3, 1)]:
-        yield xstack, 'd', (shp, shp), (), context
+        xstack('d', (shp, shp), (), context)
 
 
 def xstack(l, shps, tup, ctx):
--- a/pygpu/tests/test_reduction.py
+++ b/pygpu/tests/test_reduction.py
@@ -23,7 +23,7 @@ def test_red_array_basic():
                              ((8, 5, 10), [False, True, False]),
                              ((8, 5, 10), [False, False, True]),
                              ]:
-            yield red_array_sum, dtype, shape, redux
+            red_array_sum(dtype, shape, redux)
 
 
 @guard_devsup
@@ -50,7 +50,7 @@ def test_red_big_array():
                   [True, False, True],
                   [False, True, True],
                   [False, True, False]]:
-        yield red_array_sum, 'float32', (2000, 30, 100), redux
+        red_array_sum('float32', (2000, 30, 100), redux)
 
 # this test needs a guard_devsup because Python 'float' is double,
 # and placing one directly on a test_* makes nose not know that it's a test
@@ -87,10 +87,10 @@ def red_broadcast():
 def test_reduction_ops():
     for axis in [None, 0, 1]:
         for op in ['all', 'any']:
-            yield reduction_op, op, 'bool', axis
+            reduction_op(op, 'bool', axis)
         for op in ['prod', 'sum']:  # 'min', 'max']:
             for dtype in dtypes_no_complex:
-                yield reduction_op, op, dtype, axis
+                reduction_op(op, dtype, axis)
 
 
 @guard_devsup