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 = 1
        name.observed_2 = 1.25
        name.name = 'i'+str(qualty)
        instlist.append(name)
    return instlist
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 = 1
        name.observed_2 = 1.25
        name.name = 'i' + str(qualty)
        instlist.append(name)
    return instlist
 def test_interview_few(self):
     """
     Interview selection Test 1: , number that apply < number to interview
     """
     inst = Inst()
     inst.quality = 50
     inst.number_to_interview = 10
     inst.applied = setup_app()[:5]
     inst.interview()
     desired = {'a20', 'a90', 'a100', 'a50', 'a80'}
     actual = set([app.name for app in inst.invite_interview])
     self.assertEqual(desired, actual,
                      'desired '+str(desired)+' != '+ 'Actual '+str(actual))
 def test_interview_few(self):
     """
     Interview selection Test 1: , number that apply < number to interview
     """
     inst = Inst()
     inst.quality = 50
     inst.number_to_interview = 10
     inst.applied = setup_app()[:5]
     inst.interview()
     desired = {'a20', 'a90', 'a100', 'a50', 'a80'}
     actual = set([app.name for app in inst.invite_interview])
     self.assertEqual(
         desired, actual,
         'desired ' + str(desired) + ' != ' + 'Actual ' + str(actual))
    def test_inst_rank_app(self):
        """
        Rank selection Test 1:
        """
        inst = Inst()
        inst.quality = 50
        inst.num_to_rank = 5
        inst.accept_range = [.5, 1000]
#TODO: need to filter based on inst.accept_range
        inst.inst_rank_app(setup_app())
        #order matters on rank_list
# TODO # Need to determin the right answer
        desired = ['a100', 'a90', 'a80', 'a70', 'a60', 'a50', 'a40', 'a30', 'a20', 'a10'] # Need to determin the right answer
        actual = [app.name for app in inst.rank_list]
        print('actual 2',actual)
        self.assertEqual(desired, actual,
                         'desired '+str(desired)+' != '+ 'Actual '+str(actual))
 def test_inst_rank_app(self):
     """
     Rank selection Test 1:
     """
     inst = Inst()
     inst.quality = 50
     inst.num_to_rank = 5
     inst.accept_range = [.5, 1000]
     #TODO: need to filter based on inst.accept_range
     inst.inst_rank_app(setup_app())
     #order matters on rank_list
     # TODO # Need to determin the right answer
     desired = [
         'a100', 'a90', 'a80', 'a70', 'a60', 'a50', 'a40', 'a30', 'a20',
         'a10'
     ]  # Need to determin the right answer
     actual = [app.name for app in inst.rank_list]
     print('actual 2', actual)
     self.assertEqual(
         desired, actual,
         'desired ' + str(desired) + ' != ' + 'Actual ' + str(actual))