Skip to content

Commit b0d336c

Browse files
committed
take flat_middle out of scope
1 parent fe1263f commit b0d336c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

adaptive/tests/test_learner1d.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
from adaptive.runner import BlockingRunner, simple
1010

1111

12+
def flat_middle(x):
13+
x *= 1e7
14+
xs = np.array([0.0, 0.1, 0.9, 1.0])
15+
ys = [0, 1, 1, 0]
16+
if x < xs[1] or x > xs[-2]:
17+
time.sleep(1)
18+
return np.interp(x, xs, ys)
19+
20+
1221
def test_pending_loss_intervals():
1322
# https://github.com/python-adaptive/adaptive/issues/40
1423
learner = Learner1D(lambda x: x, (0, 4))
@@ -393,14 +402,6 @@ def f(x):
393402

394403

395404
def test_inf_loss_with_missing_bounds():
396-
def flat_middle(x):
397-
x *= 1e7
398-
xs = np.array([0.0, 0.1, 0.9, 1.0])
399-
ys = [0, 1, 1, 0]
400-
if x < xs[1] or x > xs[-2]:
401-
time.sleep(1)
402-
return np.interp(x, xs, ys)
403-
404405
learner = Learner1D(
405406
flat_middle,
406407
bounds=(0, 1e-7),

0 commit comments

Comments
 (0)