def testing_legajo(self, employee): for n in range(len(employee)): Administration().add_employee(employee[n]) NumLeg = [*Administration().listEmployee.keys()] NumLegRange = [n for n in range(len(NumLeg))] self.assertEqual(NumLeg, NumLegRange)
def test_add_employee(self, name, surname, age, phone, salary, legajo): emp = Employee("Oriel", "Barroso", 23, 155, 23000, 0).get_employee() emp2 = Employee("Nicolas", "Barroso", 32, 156, 32000, 1).get_employee() adm = Administration() adm.add_employee(emp) adm.add_employee(emp2) self.assertTrue(adm.listEmployee)
def test_add_employee(self, name, surname, age, phone, legajo): person = Person(name, surname, age, phone) personDict = person.get_person() administration = Administration() administration.add_employee(personDict) self.assertDictEqual(administration.listEmployee[legajo], personDict)
def main(): bot.add_cog(Input(bot)) bot.add_cog(Output(bot)) bot.add_cog(Administration(bot)) bot.add_cog(Usage(bot)) bot.run(TOKEN) db_cursor.close() db_connection.close()
def test_legajo(self, empleados): adm = Administration() #Reemplaza el nombre de la funcion para comodidad de tipeo. for n in range(len(empleados)): adm.add_employee(empleados[n]) #Crea la lista con los Legajos generados de cada empleado. print (empleados) NL = [*adm.listEmployee.keys()] #NL = Numero de Legajo. Separa los Legajos(Claves/Keys) y los guarda en una lista. NLR = [n for n in range (len(NL))] #NLC = Numero de Legajo Registrado. self.assertListEqual (NL, NLR) #Compara ambas listas para comprobar si son iguales. print (NL, NLR)
def setUp(self): self.adm = Administration()
def test_add_employee(self, name, surname, age, phone, salary, legajo, result): employee = Employee(name, surname, age, phone, salary) adm = Administration() adm.add_employee(employee.get_employee()) self.assertEqual(adm.listEmployee[legajo], result)
def test_add_employee(self, name, surname, age, phone, salary, legajo): employee = Employee(name, surname, age, phone, salary) adm = Administration() dictEmployee = employee.get_employee() adm.add_employee(dictEmployee) self.assertDictEqual(adm.listEmployee[legajo], dictEmployee)
import unittest from employee import Employee from administration import Administration from parameterized import parameterized class TestAdminitration(unittest.TestCase): @parameterized.expand([('Mariano', 'Saez', 20, 2995922296, 30000, 0), ('Agustin', 'Prieto', 20, 261756890, 29999, 1), ('Matias', 'Robbio', 19, 2613424565, 90000, 2), ('Bruno', 'Bonil', 19, 261890098, 100000, 3)]) def test_add_employee(self, name, surname, age, phone, salary, legajo): # Creamos una instancia de employee llamada empleado empleado = Employee(name, surname, age, phone, salary) # Agregamos a empleado a la lista de empleados de la instancia de # Administration que se crea en el main adm.add_employee(empleado) # Dado que conocemos el legajo que se asignara a empleado podemos # comparar si el elemento almacenado en # la key = legajo es igual a empleado (deberia ser el mismo) self.assertEqual(adm.listemployee[legajo], empleado) if __name__ == '__main__': # Instanciamos Administration adm = Administration() unittest.main()
def test_administration(self, name, surname, age, phone, salary, key): for i in range(len(list(Administration().listEmployee))): empleado = Employee(name, surname, age, phone, salary).get_employee() administ = Administration().add_employee(empleado) asertEqual(administ[i], i)
def test_administration(self,name,surname,age,phone,salary, key): empleado1 = Employee(name,surname,age,phone,salary) admin=Administration() admin.add_employee(empleado1) self.assertEqual(empleado1, admin.listEmployee[key])
def test_add_employee(self, name, surname, age, phone, salary, legajo): empleado = Employee(name, surname, age, phone, salary) admin = Administration() admin.add_employee(empleado) self.assertEqual(Administration.listEmployee[legajo], empleado)