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