Skip to content

Commit

Permalink
add a previously failing test
Browse files Browse the repository at this point in the history
This was fixed by #268
  • Loading branch information
basnijholt committed Apr 24, 2020
1 parent 5754320 commit 384f409
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions adaptive/tests/test_sequence_learner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import asyncio

from adaptive import Runner, SequenceLearner
from adaptive.runner import SequentialExecutor


class FailOnce:
def __init__(self):
self.failed = False

def __call__(self, value):
if self.failed:
return value
self.failed = True
raise RuntimeError


def test_fail_with_sequence_of_unhashable():
# https://github.com/python-adaptive/adaptive/issues/265
seq = [{1: 1}] # unhashable
learner = SequenceLearner(FailOnce(), sequence=seq)
runner = Runner(
learner, goal=SequenceLearner.done, retries=1, executor=SequentialExecutor()
)
asyncio.get_event_loop().run_until_complete(runner.task)
assert runner.status() == "finished"

0 comments on commit 384f409

Please sign in to comment.