Now, we would like to test how the threshold acceptance for the merge request works, just by providing data samples of what the context looks like without needing the entire MergeRequest object. We want to test the part of the status property that is after the line that checks if it's closed, but independently.
The best way to achieve this is to separate that component into another class, use composition, and then move on to test this new abstraction with its own test suite:
class AcceptanceThreshold: def __init__(self, merge_request_context: dict) -> None: self._context = merge_request_context def status(self): if self._context["downvotes"]: return MergeRequestStatus.REJECTED elif len(self._context["upvotes"]) >= 2: return ...