diff --git a/src/pip/_internal/index.py b/src/pip/_internal/index.py index 2fa805555..881ffcc37 100644 --- a/src/pip/_internal/index.py +++ b/src/pip/_internal/index.py @@ -565,6 +565,13 @@ class BestCandidateResult(object): :param best_candidate: The most preferred candidate found, or None if no applicable candidates were found. """ + assert set(applicable_candidates) <= set(candidates) + + if best_candidate is None: + assert not applicable_candidates + else: + assert best_candidate in applicable_candidates + self._applicable_candidates = applicable_candidates self._candidates = candidates