def delete(self, persona): sql = """DELETE FROM per WHERE clave =%s""" toDelete = (persona.get_id(),) self.Conec.execute(sql, toDelete) def find(self, persona): sql = """select * from per where clave =%s""" toFind = (persona.get_id()) self.Conec.executeQuery(sql,toFind) def findAll(self): sql = """select * from per""" toRead = ('per') self.Conec.executeQuery(sql) if __name__ == '__main__': da = Dao() pr = Person() #pr.set_name('beto') pr.set_id('10') #pr.set_address('casa') # pr.set_phone('2222') #da.insert(pr) #da.update(pr) #da.delete(pr) #da.find(pr)
def test_get_person(self, nombre, apellido, edad, mail, diccionario): persona = Person(nombre, apellido, edad, mail) dicPersona = persona.get_persona() self.assertEqual(dicPersona, diccionario)
def test_get_person(self, name, apellido, age, tel, string): person = Person(name, apellido, age, tel).get_person() self.assertEqual(person, string)
def test_get_person(self,name, age, string): person = Person(name, age).get_person() self.assertEqual(person, string)
from os import name from persona import Person from Dao import Dao import persona import tkinter as tk if __name__ == '__main__': myDao = Dao() per = Person() def btnInsertClicked(): per.set_id(e1.get()) per.set_name(e2.get()) per.set_address(e3.get()) per.set_phone(e4.get()) print(e1.get() + e2.get() + e3.get() + e4.get()) myDao.insert(per) cleanScreen() def btnUpdateClicked(): per.setId(e1.get()) per.setname(e2.get()) per.setaddress(e3.get()) per.setphone(e4.get()) print(e1.get() + e2.get() + e3.get() + e4.get()) myDao.update(per) cleanScreen() def btnDeleteClicked(): per.setId(e1.get())