def p_randomly(params, step, sL, s): """ Randomly picks a Participant from the network and asks him if he wants to create a Proposal. """ funding_pool = s["funding_pool"] network = s["network"] participants = get_participants(network) i, participant = random.sample(participants, 1)[0] wants_to_create_proposal = participant.create_proposal(calc_total_funds_requested( network), calc_median_affinity(network), funding_pool) return {"new_proposal": wants_to_create_proposal, "proposed_by_participant": i}
def p_randomly(params, step, sL, s, **kwargs): """ Randomly picks a Participant from the network and asks him if he wants to create a Proposal. """ funding_pool = s["funding_pool"] network = s["network"] choice_func = params["choice_func"] participants = get_participants(network) participants_dict = dict(participants) i = choice_func(list(participants_dict)) participant = participants_dict[i] wants_to_create_proposal = participant.create_proposal(calc_total_funds_requested( network), calc_median_affinity(network), funding_pool) return {"new_proposal": wants_to_create_proposal, "proposed_by_participant": i}
def test_calc_total_funds_requested(self): sum = calc_total_funds_requested(self.network) self.assertEqual(sum, 50)