Skip to content

Commit 79a318b

Browse files
fix: Explicitly unpack size-1 arrays when a scalar needed.
This is failing tests in 3.14, even when the same version of numpy passes on 3.13
1 parent 50dbfe2 commit 79a318b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

test/test_weak.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def true_f(x):
9696
return x**2
9797

9898
test_func = UniformEvenBump(p)
99-
expected = quad(lambda x: true_f(x) * test_func.phi(np.array([x]), d), -1, 1)[0]
99+
expected = quad(lambda x: true_f(x) * test_func.phi(np.array([x])[0], d), -1, 1)[0]
100100
x_i = np.linspace(-1, 1, n_grid)
101101
f_i = true_f(x_i)
102102
weights = _linear_weights(x_i, d, test_func)
@@ -119,7 +119,7 @@ def test_integrate_domain1d(true_f, p, deriv_op):
119119
def integrand(x):
120120
return (
121121
true_f(x)
122-
* test_func.phi(np.array([y_of_x(x)]), deriv_op[0])
122+
* test_func.phi(np.array([y_of_x(x)]), deriv_op[0])[0]
123123
* dy_dx ** deriv_op[0]
124124
)
125125

@@ -161,8 +161,8 @@ def test_integrate_domain2d(true_f, p, deriv_op):
161161
def integrand(y, x): # yes... y, then x
162162
return (
163163
true_f(x, y)
164-
* test_func.phi(np.array([u_of_x(x)]), deriv_op[0])
165-
* test_func.phi(np.array([u_of_y(y)]), deriv_op[1])
164+
* test_func.phi(np.array([u_of_x(x)]), deriv_op[0])[0]
165+
* test_func.phi(np.array([u_of_y(y)]), deriv_op[1])[0]
166166
* du_dx ** deriv_op[0]
167167
* du_dy ** deriv_op[1]
168168
)
@@ -274,7 +274,7 @@ def true_udot(x):
274274
return 2 * x
275275

276276
def integrand(x):
277-
return true_udot(x) * test_func.phi(y_of_x(x))
277+
return true_udot(x) * test_func.phi(y_of_x(x))[0]
278278

279279
u = true_u(simple_time_domain.domain)
280280
expected, _ = quad(integrand, xl, xu)
@@ -313,7 +313,7 @@ def true_udot(x):
313313
return 2 * x
314314

315315
def integrand(x):
316-
return true_udot(x) * test_func.phi(y_of_x(x))
316+
return true_udot(x) * test_func.phi(y_of_x(x))[0]
317317

318318
u = true_u(simple_time_domain.domain)
319319
x_dot = true_udot(simple_time_domain.domain)

0 commit comments

Comments
 (0)