def setup_inst():
    instlist =[]
    for qualty in [100,20,90,80,50,30,40,10,70,60]:
        name = Inst()
        name.quality = qualty
        name.observed_1 = .8
        name.observed_2 = 1.25
        name.number_to_interview = 5
        name.openings = 2
        name.name = 'i'+str(qualty)
        instlist.append(name)
    return instlist
 def test_Proposed_applicant_1(self):
     """Proposed_applicant_1: Institution has room (is not filled) accepts
     applicant
     """
     apps = setup_app()
     #setup institution
     inst = Inst()
     inst.matched_to = [apps[5], apps[3]]
     #inst.rank_list = apps Next line takes care of this
     inst.inst_rank_app(apps)
     inst.bumped_applicants = [apps[1]]
     inst.ranked_to_low = []
     inst.openings = 5
     results = inst.Proposed_applicant(apps[6])
     self.assertEqual((results[0] and results[1] is None), True,
                      'There was room, applicant should have been accepted' +
                      str(results[0]) + ' ' + str(results[1]))
 def test_Proposed_applicant_3(self):
     """Proposed_applicant_3: Institution is filled applicant can NOT bump
     """
     apps = setup_app()
     #setup institution
     inst = Inst()
     #inst.rank_list = apps Next line takes care of this
     inst.inst_rank_app(apps)
     inst.matched_to = [inst.rank_list[0], inst.rank_list[1], 
                        inst.rank_list[2], inst.rank_list[3]]
     inst.bumped_applicants = [inst.rank_list[9]]
     inst.ranked_to_low = []
     inst.openings = 4
     results = inst.Proposed_applicant(inst.rank_list[4])
     self.assertEqual((not(results[0]) and results[1] is None), True,
                      ('Applicant should have matched '+
                      str(results[0]) + ' ' +str(results[1])))
 def test_Proposed_applicant_2(self):
     """Proposed_applicant_2: Institution is filled applicant can bump lowest
     ranked applicant
     """
     apps = setup_app()
     #setup institution
     inst = Inst()
     #inst.rank_list = apps Next line takes care of this
     inst.inst_rank_app(apps)
     inst.matched_to = [inst.rank_list[0], inst.rank_list[2], 
                        inst.rank_list[4], inst.rank_list[6]]
     inst.bumped_applicants = [inst.rank_list[9]]
     inst.ranked_to_low = []
     inst.openings = 4
     results = inst.Proposed_applicant(inst.rank_list[1])
     self.assertEqual((results[0] and results[1]==inst.rank_list[6]), True, 
                      'Applicant should have bumped a10 '+
                      str(results[0]) + ' ' +str(results[1].name))
 def test_Proposed_applicant_1(self):
     """Proposed_applicant_1: Institution has room (is not filled) accepts
     applicant
     """
     apps = setup_app()
     #setup institution
     inst = Inst()
     inst.matched_to = [apps[5], apps[3]]
     #inst.rank_list = apps Next line takes care of this
     inst.inst_rank_app(apps)
     inst.bumped_applicants = [apps[1]]
     inst.ranked_to_low = []
     inst.openings = 5
     results = inst.Proposed_applicant(apps[6])
     self.assertEqual(
         (results[0] and results[1] is None), True,
         'There was room, applicant should have been accepted' +
         str(results[0]) + ' ' + str(results[1]))
 def test_Proposed_applicant_3(self):
     """Proposed_applicant_3: Institution is filled applicant can NOT bump
     """
     apps = setup_app()
     #setup institution
     inst = Inst()
     #inst.rank_list = apps Next line takes care of this
     inst.inst_rank_app(apps)
     inst.matched_to = [
         inst.rank_list[0], inst.rank_list[1], inst.rank_list[2],
         inst.rank_list[3]
     ]
     inst.bumped_applicants = [inst.rank_list[9]]
     inst.ranked_to_low = []
     inst.openings = 4
     results = inst.Proposed_applicant(inst.rank_list[4])
     self.assertEqual((not (results[0]) and results[1] is None), True,
                      ('Applicant should have matched ' + str(results[0]) +
                       ' ' + str(results[1])))
 def test_Proposed_applicant_2(self):
     """Proposed_applicant_2: Institution is filled applicant can bump lowest
     ranked applicant
     """
     apps = setup_app()
     #setup institution
     inst = Inst()
     #inst.rank_list = apps Next line takes care of this
     inst.inst_rank_app(apps)
     inst.matched_to = [
         inst.rank_list[0], inst.rank_list[2], inst.rank_list[4],
         inst.rank_list[6]
     ]
     inst.bumped_applicants = [inst.rank_list[9]]
     inst.ranked_to_low = []
     inst.openings = 4
     results = inst.Proposed_applicant(inst.rank_list[1])
     self.assertEqual((results[0] and results[1] == inst.rank_list[6]),
                      True, 'Applicant should have bumped a10 ' +
                      str(results[0]) + ' ' + str(results[1].name))