def requests(): def _getDigest(req: Request): return sha256(req.identifier.encode()) requests = Requests() for id in req_identifiers: req = Request(id) req.getDigest = functools.partial(_getDigest, req) requests.add(req) assert len(requests) == 3 return requests
def requests(): def _getDigest(req: Request): return sha256(req.identifier.encode()) requests = Requests() req = Request("1") req.getDigest = functools.partial(_getDigest, req) requests.add(req) assert len(requests) == 1 return requests, req.key