@@ -35,163 +35,163 @@ def test_coerced_usm_types_add(usm_type_x, usm_type_y):
35
35
assert z .usm_type == du .get_coerced_usm_type ([usm_type_x , usm_type_y ])
36
36
37
37
38
- # @pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
39
- # @pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
40
- # def test_coerced_usm_types_mul(usm_type_x, usm_type_y):
41
- # x = dp.arange(10, usm_type=usm_type_x)
42
- # y = dp.arange(10, usm_type=usm_type_y)
38
+ @pytest .mark .parametrize ("usm_type_x" , list_of_usm_types , ids = list_of_usm_types )
39
+ @pytest .mark .parametrize ("usm_type_y" , list_of_usm_types , ids = list_of_usm_types )
40
+ def test_coerced_usm_types_mul (usm_type_x , usm_type_y ):
41
+ x = dp .arange (10 , usm_type = usm_type_x )
42
+ y = dp .arange (10 , usm_type = usm_type_y )
43
43
44
- # z = 3 * x * y * 1.5
44
+ z = 3 * x * y * 1.5
45
45
46
- # # inplace multiply
47
- # z *= x
48
- # z *= 4.8
46
+ # inplace multiply
47
+ z *= x
48
+ z *= 4.8
49
49
50
- # assert x.usm_type == usm_type_x
51
- # assert y.usm_type == usm_type_y
52
- # assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])
50
+ assert x .usm_type == usm_type_x
51
+ assert y .usm_type == usm_type_y
52
+ assert z .usm_type == du .get_coerced_usm_type ([usm_type_x , usm_type_y ])
53
53
54
54
55
- # @pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
56
- # @pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
57
- # def test_coerced_usm_types_subtract(usm_type_x, usm_type_y):
58
- # x = dp.arange(50, usm_type=usm_type_x)
59
- # y = dp.arange(50, usm_type=usm_type_y)
55
+ @pytest .mark .parametrize ("usm_type_x" , list_of_usm_types , ids = list_of_usm_types )
56
+ @pytest .mark .parametrize ("usm_type_y" , list_of_usm_types , ids = list_of_usm_types )
57
+ def test_coerced_usm_types_subtract (usm_type_x , usm_type_y ):
58
+ x = dp .arange (50 , usm_type = usm_type_x )
59
+ y = dp .arange (50 , usm_type = usm_type_y )
60
60
61
- # z = 20 - x - y - 7.4
61
+ z = 20 - x - y - 7.4
62
62
63
- # # inplace subtract
64
- # z -= x
65
- # z -= -3.4
63
+ # inplace subtract
64
+ z -= x
65
+ z -= - 3.4
66
66
67
- # assert x.usm_type == usm_type_x
68
- # assert y.usm_type == usm_type_y
69
- # assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])
67
+ assert x .usm_type == usm_type_x
68
+ assert y .usm_type == usm_type_y
69
+ assert z .usm_type == du .get_coerced_usm_type ([usm_type_x , usm_type_y ])
70
70
71
71
72
- # @pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
73
- # @pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
74
- # def test_coerced_usm_types_divide(usm_type_x, usm_type_y):
75
- # x = dp.arange(120, usm_type=usm_type_x)
76
- # y = dp.arange(120, usm_type=usm_type_y)
72
+ @pytest .mark .parametrize ("usm_type_x" , list_of_usm_types , ids = list_of_usm_types )
73
+ @pytest .mark .parametrize ("usm_type_y" , list_of_usm_types , ids = list_of_usm_types )
74
+ def test_coerced_usm_types_divide (usm_type_x , usm_type_y ):
75
+ x = dp .arange (120 , usm_type = usm_type_x )
76
+ y = dp .arange (120 , usm_type = usm_type_y )
77
77
78
- # z = 2 / x / y / 1.5
78
+ z = 2 / x / y / 1.5
79
79
80
- # # inplace divide
81
- # z /= x
82
- # z /= -2.4
80
+ # inplace divide
81
+ z /= x
82
+ z /= - 2.4
83
83
84
- # assert x.usm_type == usm_type_x
85
- # assert y.usm_type == usm_type_y
86
- # assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])
84
+ assert x .usm_type == usm_type_x
85
+ assert y .usm_type == usm_type_y
86
+ assert z .usm_type == du .get_coerced_usm_type ([usm_type_x , usm_type_y ])
87
87
88
88
89
- # @pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
90
- # @pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
91
- # def test_coerced_usm_types_remainder(usm_type_x, usm_type_y):
92
- # x = dp.arange(100, usm_type=usm_type_x).reshape(10, 10)
93
- # y = dp.arange(100, usm_type=usm_type_y).reshape(10, 10)
94
- # y = y.T + 1
89
+ @pytest .mark .parametrize ("usm_type_x" , list_of_usm_types , ids = list_of_usm_types )
90
+ @pytest .mark .parametrize ("usm_type_y" , list_of_usm_types , ids = list_of_usm_types )
91
+ def test_coerced_usm_types_remainder (usm_type_x , usm_type_y ):
92
+ x = dp .arange (100 , usm_type = usm_type_x ).reshape (10 , 10 )
93
+ y = dp .arange (100 , usm_type = usm_type_y ).reshape (10 , 10 )
94
+ y = y .T + 1
95
95
96
- # z = 100 % y
97
- # z = y % 7
98
- # z = x % y
96
+ z = 100 % y
97
+ z = y % 7
98
+ z = x % y
99
99
100
- # # inplace remainder
101
- # z %= y
102
- # z %= 5
100
+ # inplace remainder
101
+ z %= y
102
+ z %= 5
103
103
104
- # assert x.usm_type == usm_type_x
105
- # assert y.usm_type == usm_type_y
106
- # assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])
104
+ assert x .usm_type == usm_type_x
105
+ assert y .usm_type == usm_type_y
106
+ assert z .usm_type == du .get_coerced_usm_type ([usm_type_x , usm_type_y ])
107
107
108
108
109
- # @pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
110
- # @pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
111
- # def test_coerced_usm_types_floor_divide(usm_type_x, usm_type_y):
112
- # x = dp.arange(100, usm_type=usm_type_x).reshape(10, 10)
113
- # y = dp.arange(100, usm_type=usm_type_y).reshape(10, 10)
114
- # x = x + 1.5
115
- # y = y.T + 0.5
109
+ @pytest .mark .parametrize ("usm_type_x" , list_of_usm_types , ids = list_of_usm_types )
110
+ @pytest .mark .parametrize ("usm_type_y" , list_of_usm_types , ids = list_of_usm_types )
111
+ def test_coerced_usm_types_floor_divide (usm_type_x , usm_type_y ):
112
+ x = dp .arange (100 , usm_type = usm_type_x ).reshape (10 , 10 )
113
+ y = dp .arange (100 , usm_type = usm_type_y ).reshape (10 , 10 )
114
+ x = x + 1.5
115
+ y = y .T + 0.5
116
116
117
- # z = 3.4 // y
118
- # z = y // 2.7
119
- # z = x // y
117
+ z = 3.4 // y
118
+ z = y // 2.7
119
+ z = x // y
120
120
121
- # # inplace floor_divide
122
- # z //= y
123
- # z //= 2.5
121
+ # inplace floor_divide
122
+ z //= y
123
+ z //= 2.5
124
124
125
- # assert x.usm_type == usm_type_x
126
- # assert y.usm_type == usm_type_y
127
- # assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])
125
+ assert x .usm_type == usm_type_x
126
+ assert y .usm_type == usm_type_y
127
+ assert z .usm_type == du .get_coerced_usm_type ([usm_type_x , usm_type_y ])
128
128
129
129
130
- # @pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
131
- # @pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
132
- # def test_coerced_usm_types_power(usm_type_x, usm_type_y):
133
- # x = dp.arange(70, usm_type=usm_type_x).reshape((7, 5, 2))
134
- # y = dp.arange(70, usm_type=usm_type_y).reshape((7, 5, 2))
130
+ @pytest .mark .parametrize ("usm_type_x" , list_of_usm_types , ids = list_of_usm_types )
131
+ @pytest .mark .parametrize ("usm_type_y" , list_of_usm_types , ids = list_of_usm_types )
132
+ def test_coerced_usm_types_power (usm_type_x , usm_type_y ):
133
+ x = dp .arange (70 , usm_type = usm_type_x ).reshape ((7 , 5 , 2 ))
134
+ y = dp .arange (70 , usm_type = usm_type_y ).reshape ((7 , 5 , 2 ))
135
135
136
- # z = 2**x**y**1.5
137
- # z **= x
138
- # z **= 1.7
136
+ z = 2 ** x ** y ** 1.5
137
+ z **= x
138
+ z **= 1.7
139
139
140
- # assert x.usm_type == usm_type_x
141
- # assert y.usm_type == usm_type_y
142
- # assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])
140
+ assert x .usm_type == usm_type_x
141
+ assert y .usm_type == usm_type_y
142
+ assert z .usm_type == du .get_coerced_usm_type ([usm_type_x , usm_type_y ])
143
143
144
144
145
- # @pytest.mark.parametrize(
146
- # "func, args",
147
- # [
148
- # pytest.param("copy", ["x0"]),
149
- # pytest.param("diag", ["x0"]),
150
- # pytest.param("empty_like", ["x0"]),
151
- # pytest.param("full", ["10", "x0[3]"]),
152
- # pytest.param("full_like", ["x0", "4"]),
153
- # pytest.param("geomspace", ["x0[0:3]", "8", "4"]),
154
- # pytest.param("geomspace", ["1", "x0[3:5]", "4"]),
155
- # pytest.param("linspace", ["x0[0:2]", "8", "4"]),
156
- # pytest.param("linspace", ["0", "x0[3:5]", "4"]),
157
- # pytest.param("logspace", ["x0[0:2]", "8", "4"]),
158
- # pytest.param("logspace", ["0", "x0[3:5]", "4"]),
159
- # pytest.param("ones_like", ["x0"]),
160
- # pytest.param("vander", ["x0"]),
161
- # pytest.param("zeros_like", ["x0"]),
162
- # ],
163
- # )
164
- # @pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
165
- # @pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
166
- # def test_array_creation_from_1d_array(func, args, usm_type_x, usm_type_y):
167
- # x0 = dp.full(10, 3, usm_type=usm_type_x)
168
- # new_args = [eval(val, {"x0": x0}) for val in args]
145
+ @pytest .mark .parametrize (
146
+ "func, args" ,
147
+ [
148
+ pytest .param ("copy" , ["x0" ]),
149
+ pytest .param ("diag" , ["x0" ]),
150
+ pytest .param ("empty_like" , ["x0" ]),
151
+ pytest .param ("full" , ["10" , "x0[3]" ]),
152
+ pytest .param ("full_like" , ["x0" , "4" ]),
153
+ pytest .param ("geomspace" , ["x0[0:3]" , "8" , "4" ]),
154
+ pytest .param ("geomspace" , ["1" , "x0[3:5]" , "4" ]),
155
+ pytest .param ("linspace" , ["x0[0:2]" , "8" , "4" ]),
156
+ pytest .param ("linspace" , ["0" , "x0[3:5]" , "4" ]),
157
+ pytest .param ("logspace" , ["x0[0:2]" , "8" , "4" ]),
158
+ pytest .param ("logspace" , ["0" , "x0[3:5]" , "4" ]),
159
+ pytest .param ("ones_like" , ["x0" ]),
160
+ pytest .param ("vander" , ["x0" ]),
161
+ pytest .param ("zeros_like" , ["x0" ]),
162
+ ],
163
+ )
164
+ @pytest .mark .parametrize ("usm_type_x" , list_of_usm_types , ids = list_of_usm_types )
165
+ @pytest .mark .parametrize ("usm_type_y" , list_of_usm_types , ids = list_of_usm_types )
166
+ def test_array_creation_from_1d_array (func , args , usm_type_x , usm_type_y ):
167
+ x0 = dp .full (10 , 3 , usm_type = usm_type_x )
168
+ new_args = [eval (val , {"x0" : x0 }) for val in args ]
169
169
170
- # x = getattr(dp, func)(*new_args)
171
- # y = getattr(dp, func)(*new_args, usm_type=usm_type_y)
170
+ x = getattr (dp , func )(* new_args )
171
+ y = getattr (dp , func )(* new_args , usm_type = usm_type_y )
172
172
173
- # assert x.usm_type == usm_type_x
174
- # assert y.usm_type == usm_type_y
173
+ assert x .usm_type == usm_type_x
174
+ assert y .usm_type == usm_type_y
175
175
176
176
177
- # @pytest.mark.parametrize(
178
- # "func, args",
179
- # [
180
- # pytest.param("diag", ["x0"]),
181
- # pytest.param("diagflat", ["x0"]),
182
- # ],
183
- # )
184
- # @pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
185
- # @pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
186
- # def test_array_creation_from_2d_array(func, args, usm_type_x, usm_type_y):
187
- # x0 = dp.arange(25, usm_type=usm_type_x).reshape(5, 5)
188
- # new_args = [eval(val, {"x0": x0}) for val in args]
177
+ @pytest .mark .parametrize (
178
+ "func, args" ,
179
+ [
180
+ pytest .param ("diag" , ["x0" ]),
181
+ pytest .param ("diagflat" , ["x0" ]),
182
+ ],
183
+ )
184
+ @pytest .mark .parametrize ("usm_type_x" , list_of_usm_types , ids = list_of_usm_types )
185
+ @pytest .mark .parametrize ("usm_type_y" , list_of_usm_types , ids = list_of_usm_types )
186
+ def test_array_creation_from_2d_array (func , args , usm_type_x , usm_type_y ):
187
+ x0 = dp .arange (25 , usm_type = usm_type_x ).reshape (5 , 5 )
188
+ new_args = [eval (val , {"x0" : x0 }) for val in args ]
189
189
190
- # x = getattr(dp, func)(*new_args)
191
- # y = getattr(dp, func)(*new_args, usm_type=usm_type_y)
190
+ x = getattr (dp , func )(* new_args )
191
+ y = getattr (dp , func )(* new_args , usm_type = usm_type_y )
192
192
193
- # assert x.usm_type == usm_type_x
194
- # assert y.usm_type == usm_type_y
193
+ assert x .usm_type == usm_type_x
194
+ assert y .usm_type == usm_type_y
195
195
196
196
197
197
# @pytest.mark.parametrize(
0 commit comments