Skip to content

Commit 384f409

Browse files
committed
add a previously failing test
This was fixed by #268
1 parent 5754320 commit 384f409

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import asyncio
2+
3+
from adaptive import Runner, SequenceLearner
4+
from adaptive.runner import SequentialExecutor
5+
6+
7+
class FailOnce:
8+
def __init__(self):
9+
self.failed = False
10+
11+
def __call__(self, value):
12+
if self.failed:
13+
return value
14+
self.failed = True
15+
raise RuntimeError
16+
17+
18+
def test_fail_with_sequence_of_unhashable():
19+
# https://github.com/python-adaptive/adaptive/issues/265
20+
seq = [{1: 1}] # unhashable
21+
learner = SequenceLearner(FailOnce(), sequence=seq)
22+
runner = Runner(
23+
learner, goal=SequenceLearner.done, retries=1, executor=SequentialExecutor()
24+
)
25+
asyncio.get_event_loop().run_until_complete(runner.task)
26+
assert runner.status() == "finished"

0 commit comments

Comments
 (0)