Skip to content

Commit

Permalink
no not treat the SequenceLearner specially
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Apr 14, 2020
1 parent 2b1d70d commit 897d4c8
Showing 1 changed file with 5 additions and 26 deletions.
31 changes: 5 additions & 26 deletions adaptive/tests/test_learners.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,19 +281,9 @@ def test_adding_existing_data_is_idempotent(learner_type, f, learner_kwargs):
M = random.randint(10, 30)
pls = zip(*learner.ask(M))
cpls = zip(*control.ask(M))
if learner_type is SequenceLearner:
# The SequenceLearner's points might not be hasable
points, values = zip(*pls)
indices, points = zip(*points)

cpoints, cvalues = zip(*cpls)
cindices, cpoints = zip(*cpoints)
assert (np.array(points) == np.array(cpoints)).all()
assert values == cvalues
assert indices == cindices
else:
# Point ordering is not defined, so compare as sets
assert set(pls) == set(cpls)
# Point ordering is not defined, so compare as sets
assert set(pls) == set(cpls)


# XXX: This *should* pass (https://github.com/python-adaptive/adaptive/issues/55)
Expand Down Expand Up @@ -324,20 +314,9 @@ def test_adding_non_chosen_data(learner_type, f, learner_kwargs):
pls = zip(*learner.ask(M))
cpls = zip(*control.ask(M))

if learner_type is SequenceLearner:
# The SequenceLearner's points might not be hasable
points, values = zip(*pls)
indices, points = zip(*points)

cpoints, cvalues = zip(*cpls)
cindices, cpoints = zip(*cpoints)
assert (np.array(points) == np.array(cpoints)).all()
assert values == cvalues
assert indices == cindices
else:
# Point ordering within a single call to 'ask'
# is not guaranteed to be the same by the API.
assert set(pls) == set(cpls)
# Point ordering within a single call to 'ask'
# is not guaranteed to be the same by the API.
assert set(pls) == set(cpls)


@run_with(Learner1D, xfail(Learner2D), xfail(LearnerND), AverageLearner)
Expand Down

0 comments on commit 897d4c8

Please sign in to comment.