Add some assertions to BestCandidateResult.__init__().
@@ -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
